Skip to content

workspaceContains starts a search over full workspace, including .git/, node_modules/ #34711

Closed

Description

@roblourens

#34487 made one improvement by batching workspaceContains searches.

Keeping this one open to consider excluding .git and node_modules in a smart way, which could give a huge improvement.

cc Johannes Rieken (@jrieken) alexandrudima

We should include the exclude settings, or hardcode an exclusion to a few folders.

So, how do you then active on .git/HEAD?

Maybe add some smartness to search .git/ or node_modules/ if it's explicitly mentioned in the workspaceContains: search glob?

Activity

  1. added
    extension-host
    on Sep 20, 2017
  2. alexdima commented on Sep 21, 2017

    @alexdima
    Member

    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.

  3. roblourens commented on Nov 7, 2017

    @roblourens
    MemberAuthor

    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

  4. sandy081 commented on Nov 7, 2017

    @sandy081
    Member

    roblourens Yes. It supports querying on activationEvent by passing a regEx value. For example

    activationEvents:`^workspaceContains.*\\*.csx\`
    

    will give you extensions activating on workspace containing .csx files.

  5. roblourens commented on Nov 8, 2017

    @roblourens
    MemberAuthor

    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/

  6. jens1o commented on Nov 21, 2017

    @jens1o
    Contributor

    Is this considered for November 2017? This would be important for me.

  7. added
    under-discussion
    on Nov 26, 2017
  8. chrmarti commented on Feb 27, 2018

    @chrmarti
    Collaborator

    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).

  9. alexdima commented on Feb 27, 2018

    @alexdima
    Member

    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.

  10. 39 remaining items

  11. added
    verification-needed
    on Sep 5, 2018
  12. added
    release-notes
    on Sep 14, 2018
  13. added a commit that references this issue on Sep 15, 2018
  14. roblourens commented on Sep 15, 2018

    @roblourens
    MemberAuthor

    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

  15. roblourens commented on Sep 17, 2018

    @roblourens
    MemberAuthor

    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.

  16. octref commented on Sep 26, 2018

    @octref
    Contributor

    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.
  17. added
    verified
    on Sep 26, 2018
  18. chpxu commented on Oct 21, 2018

    @chpxu

    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

  19. roblourens commented on Oct 21, 2018

    @roblourens
    MemberAuthor

    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

  20. locked and limited conversation to collaborators on Nov 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

extension-hostfeature-requestperfperf-startuprelease-notesverification-neededverified

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions