vscode: Npm Scripts view not available if package.json located only in nested folder
Issue Type: Bug
Noticed that in project where there is no package.json file in root folder I cannot show Npm Scripts view (even from context menu on other views in explorer folder.
Structure
project-folder
|--backend1
|--backend2
|--static
\--ui
|--src (contains app source)
|--tools
| |--tool1
| | \--package.json
| |
| \--tool2
| \--package.json
|
\--pacakge.json (main)
In this case unless I open any of 3 package.json files (in ui, ui/tools/tool1, and ui/tools/tool2) it’s not possible to get that view, see tasks an run them. I also haven’t found any command to force Npm Scripts visibility.
However as soon as I open any of them - I can see view with all 3 package.json files and their tasks in it.
UPD. Removed wrong code pointers and assumptions.
Tried with default value of npm.autoDetect and explicitly putting "npm.autoDetect": "on" in User and Workspace settings.
VS Code version: Code - Insiders 1.55.0-insider (6f726bcdf6a4d6cb518a3fcdb03c21be7293f417, 2021-03-25T08:19:33.237Z) OS version: Windows_NT x64 10.0.19041
System Info
| Item | Value |
|---|---|
| CPUs | Intel® Core™ i7-8700 CPU @ 3.20GHz (12 x 3192) |
| GPU Status | 2d_canvas: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on oop_rasterization: enabled opengl: enabled_on protected_video_decode: enabled rasterization: enabled skia_renderer: enabled_on video_decode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
| Load (avg) | undefined |
| Memory (System) | 31.72GB (19.75GB free) |
| Process Argv | –crash-reporter-id cf52dbde-2c94-45c3-9bf3-45d8b9966b04 |
| Screen Reader | no |
| VM | 0% |
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 29
- Comments: 20 (6 by maintainers)
Commits related to this issue
- fix #119868 add an option to always search the workspace for package.json — committed to nrayburn-tech/vscode by nrayburn-cyber 3 years ago
Did this change recently? I could previously see my npm scripts, even though the package.json was one folder deep. Until I updated today, that is.
Certainly, that’s a reasonable feature request!
In the latest version of Visual Code the “npm scripts” were missing and i was not able to find it under views either. Found a solution by going manually to the correct folder and running “code .” to start the the visual code editor, then the npm scripts tab is available and it is possible to run the scripts.