You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
workspaceContains starts a search over full workspace, including .git/, node_modules/ #34711
Analyse how many extensions in the marketplace use workspaceContains glob patterns and take a look if anyone of them would be negatively impacted if we would include the search excludes in there.
It would really help if a workspaceContains search would skip files.exclude. But in theory, extensions that activate on SCM files, particular node_modules being present, etc are valid use cases, so I'm curious whether extensions like that actually exist.
Thanks! I only see one that depends on **/node_modules. A few others look in node_modules, but with no glob patterns, so it can be done without a search. But I guess it should be consistent whether glob patterns are present or not. One is actually mine, which just activates when a ./node_modules folder is present at all. I don't see any looking at .git/
I wonder if there is a general way to limit the amount of resources workspaceContains consumes. While useful for medium sized workspaces, it currently is too expensive for large ones.
One option might be to stop the search after some time (e.g., 10s) and treat it as no match (to avoid grabbing more resources).
I've noticed extensions being activated from timeout when my macbook is doing a lot. If I set "window.restoreWindows": "all" and reopen vscode with several windows, then sometimes one will have an extension activated from timeout.
I added telemetry so we can see how much this happens in the wild
If you open a very large workspace, or many windows all at once, or something like that, then you will see the notification and that is expected and by design. But if you see it when it's not expected, then you can take note of what else your computer was doing at the time that might have slowed search down. Then let me know if you see it happening at random times, and if so, we may want to raise the limit by a couple seconds, or tweak it somehow.
For example, I was thinking that instead of measuring 5s in extensionHostMain where we look at the workspaceContains pattern, we might want to include a timeout as a search option and measure closer to where the search is actually performed. Not across the extension API boundary but if we measure at the point where a search provider is invoked, that will avoid a couple IPC hops that could be blocked when the computer is very busy.
From my understanding, this is how it's supposed to work:
I create an extension that uses this activation pattern "workspaceContains:**/node_modules/express/package.json"
When I have **/node_modules excluded in files.exclude, the extension should not activate. However, in testing, this is not the case.
When I have node_modules specified in .gitignore and "search.useIgnoreFiles": true, the extension should not activate. However, in testing, this is not the case.
When I use Ripgrep, I get roughly 4 - 5 individual rg.exe in Task Manager,each roughly taking 5 - 15% CPU (Making my usage go to a constant 77% and slowing my PC heavily) and between 5 - 30 MB RAM each
VSCode 1.29.0-exploration (observed this in insiders)
Windows 10 1803 17134.345
Activity
alexdima commentedon Sep 21, 2017
I suggest we do the following:
Analyse how many extensions in the marketplace use workspaceContains glob patterns and take a look if anyone of them would be negatively impacted if we would include the search excludes in there.
Sandeep Somavarapu (@sandy081) is looking into some tooling for such use cases.
roblourens commentedon Nov 7, 2017
Sandeep Somavarapu (@sandy081) can vscode-tools help us analyze this yet?
It would really help if a workspaceContains search would skip
files.exclude. But in theory, extensions that activate on SCM files, particular node_modules being present, etc are valid use cases, so I'm curious whether extensions like that actually exist.We also have #33528 to look at this for findFiles
sandy081 commentedon Nov 7, 2017
roblourens Yes. It supports querying on activationEvent by passing a regEx value. For example
will give you extensions activating on workspace containing
.csxfiles.roblourens commentedon Nov 8, 2017
Thanks! I only see one that depends on
**/node_modules. A few others look in node_modules, but with no glob patterns, so it can be done without a search. But I guess it should be consistent whether glob patterns are present or not. One is actually mine, which just activates when a ./node_modules folder is present at all. I don't see any looking at.git/jens1o commentedon Nov 21, 2017
Is this considered for November 2017? This would be important for me.
chrmarti commentedon Feb 27, 2018
I wonder if there is a general way to limit the amount of resources
workspaceContainsconsumes. While useful for medium sized workspaces, it currently is too expensive for large ones.One option might be to stop the search after some time (e.g., 10s) and treat it as no match (to avoid grabbing more resources).
alexdima commentedon Feb 27, 2018
Christof Marti (@chrmarti) I like your suggestion.
I would also add, perhaps there is a depth setting we could use, i.e. search 4 folder levels in, and not deeper, etc.
39 remaining items
Telemetry for #34711
roblourens commentedon Sep 15, 2018
I've noticed extensions being activated from timeout when my macbook is doing a lot. If I set
"window.restoreWindows": "all"and reopen vscode with several windows, then sometimes one will have an extension activated from timeout.I added telemetry so we can see how much this happens in the wild
roblourens commentedon Sep 17, 2018
Besides what we can see in telemetry, I want to get an idea of when this will happen. I published an extension that does nothing but show a notification when it's activated, and is activated on a workspaceContains pattern that doesn't exist. If anyone wants to help out, you can install this extension https://marketplace.visualstudio.com/items?itemName=roblourens.vscode-workspacecontains-canary and take note when you see the notification.
If you open a very large workspace, or many windows all at once, or something like that, then you will see the notification and that is expected and by design. But if you see it when it's not expected, then you can take note of what else your computer was doing at the time that might have slowed search down. Then let me know if you see it happening at random times, and if so, we may want to raise the limit by a couple seconds, or tweak it somehow.
For example, I was thinking that instead of measuring 5s in extensionHostMain where we look at the workspaceContains pattern, we might want to include a timeout as a search option and measure closer to where the search is actually performed. Not across the extension API boundary but if we measure at the point where a search provider is invoked, that will avoid a couple IPC hops that could be blocked when the computer is very busy.
octref commentedon Sep 26, 2018
From my understanding, this is how it's supposed to work:
"workspaceContains:**/node_modules/express/package.json"**/node_modulesexcluded infiles.exclude, the extension should not activate. However, in testing, this is not the case.node_modulesspecified in.gitignoreand"search.useIgnoreFiles": true, the extension should not activate. However, in testing, this is not the case.Bump workspaceContains timeout - #34711
chpxu commentedon Oct 21, 2018
When I use Ripgrep, I get roughly 4 - 5 individual
rg.exein Task Manager,each roughly taking 5 - 15% CPU (Making my usage go to a constant 77% and slowing my PC heavily) and between 5 - 30 MB RAM eachVSCode 1.29.0-exploration (observed this in insiders)
Windows 10 1803 17134.345
roblourens commentedon Oct 21, 2018
Can you open a new issue with more details, because it's not clear what you mean and probably isn't relevant to this issue