Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default npm package causes tasks to take a long time to start even when task detection is disabled #45816

Closed
jtokoph opened this issue Mar 15, 2018 · 5 comments
Assignees
Labels
tasks Task system issues verified Verification succeeded
Milestone

Comments

@jtokoph
Copy link

jtokoph commented Mar 15, 2018

  • VSCode Version: 1.21.1
  • OS Version: Mac OSX 10.13.3

Steps to Reproduce:

  1. Create workspace with large directory and file structure. Or clone one. (CocoaPods/Specs is a good example)
  2. Create a task in tasks.json
{
  // See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
  "tasks": [
    {
      "label": "echo",
      "type": "shell",
      "command": "echo Hello"
    }
  ]
}

  1. Disable task autodetect in config:
"typescript.tsc.autoDetect": "off",
"jake.autoDetect": "off",
"gulp.autoDetect": "off",
"npm.autoDetect": "off",
"grunt.autoDetect": "off"
  1. Go to Tasks -> Run Task...
  2. Notice that it hangs for a long time
  3. Run ps aux. See the following process running during the hang:
/Applications/Visual Studio Code.app/Contents/Resources/app/node_modules.asar.unpacked/vscode-ripgrep/bin/rg --files --hidden --case-sensitive -g **/package.json -g !**/node_modules/** -g !**/.git -g !**/.svn -g !**/.hg -g !**/CVS -g !**/.DS_Store -g !**/*.pyc --no-ignore --follow -- .
  1. When running build task, you'll see Fetching build tasks... for a while.

Does this issue occur when all extensions are disabled?: Yes

I think this has caused a regression in performance and usability in large repositories.

The change here https://github.com/Microsoft/vscode/blob/a6dde81592febe579a24ada7b0e6d63b15a37cfd/extensions/npm/src/main.ts#L103 is calling vscode.workspace.findFiles before checking if the main workspace settings have npm.autoDetect set to on/off.

In my large workspaces I have disabled all *.autoDetect configuration options so that my default build task (cmd+shift+b) doesn't have to wait for vscode to look for all build tasks.

Before this change, my default build task started running immediately.
After this change, my default build task spends 20 seconds Fetching build tasks... before finally running my build script.

I believe this is a workflow breaking regression and have been forced to revert to the previous build of VSCode (1.20.x).

@vscodebot
Copy link

vscodebot bot commented Mar 15, 2018

@vscodebot vscodebot bot added the tasks Task system issues label Mar 15, 2018
@jtokoph
Copy link
Author

jtokoph commented Mar 15, 2018

I made a comment in the original issue that was used for tracking this change: #31217

@dbaeumer
Copy link
Member

There is one additional task auto detection we ship auto of the box. It is "typescript.tsc.autoDetect": "off". Can you try to turn that off as well and see whether it makes a difference.

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Mar 15, 2018
@jtokoph
Copy link
Author

jtokoph commented Mar 15, 2018

@dbaeumer copy paste error on my part, I already have that one disabled also and still run into the same issue. I'll update the original message to include it

@dbaeumer
Copy link
Member

@jtokoph thanks. And actually after looking at the NPM code it is clear that the find causes the issue.

@egamma the problem is that you scan for all package.json files before checking if the feature is enabled or not. May be the scanning should happen per workspace folder based on the enablement setting.

@dbaeumer dbaeumer removed the info-needed Issue requires more information from poster label Mar 16, 2018
@dbaeumer dbaeumer assigned egamma and unassigned dbaeumer Mar 16, 2018
@egamma egamma added this to the March 2018 milestone Mar 20, 2018
@egamma egamma closed this as completed in ba9da35 Mar 25, 2018
@roblourens roblourens added the verified Verification succeeded label Mar 30, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators May 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tasks Task system issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants