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

Cannot exclude root folders while searching #50638

Open
sandy081 opened this issue May 29, 2018 · 14 comments
Open

Cannot exclude root folders while searching #50638

sandy081 opened this issue May 29, 2018 · 14 comments
Assignees
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities search Search widget and operation issues
Milestone

Comments

@sandy081
Copy link
Member

Testing #50498

  • In a MR workspace, try to exclude root folder using /folder1/ and search. Results are still shown in folder1.

This happens irrespective of setting search.enableSearchProviders"

image

@roblourens
Copy link
Member

roblourens commented May 29, 2018

Yeah glob matching starts under the search folder so there's actually no way to do this...

You can include individual folders with ./name but that doesn't work in 'exclude'.

@sandy081
Copy link
Member Author

Is it possible to provide a special syntax for excluding/including root folders?

@roblourens
Copy link
Member

I would support ./name in 'exclude' too. It works in 'include'

@roblourens roblourens added feature-request Request for new features or functionality search Search widget and operation issues labels Sep 13, 2018
@roblourens roblourens added the help wanted Issues identified as good community contribution opportunities label Oct 9, 2019
@roblourens roblourens added this to the Backlog milestone Oct 27, 2019
@pacifier007
Copy link

Similar to this, it would be useful if the root folder could be referenced, not just in this use-case but in multi-root use-cases as well.

See my use-case that would be resolved easily if we could reference root folders: #91102 (comment)

Also related:
#48262
#82145

@OmeGak
Copy link

OmeGak commented Apr 9, 2020

What happened to @roblourens' idea of supporting per-folder settings in multi-root workspaces? It would also be helpful here.

@unional
Copy link

unional commented Aug 10, 2020

This is a major issue for multi-root workspace. Currently I'm hitting with the watch file limits (which I cannot change the environment) and there isn't a way to do files.exclude on the each root.

@nsgundy
Copy link

nsgundy commented Nov 4, 2020

Looking for the same thing, would like to exclude a folder on a particular root that then doesn't get excluded on any of the others.

Something like this:

"files.exclude": {
  "${workspaceFolder:rootA}/exclude": true
}

@thomaslaurie
Copy link

This was an annoying issue to track down, I thought search was bugged for the longest time.

Its an issue for me in large projects because I like to have folders like node_modules and dist added as root folders for easier access. However this prevents them from being excluded in search results, which is obviously undesirable.

@gjsjohnmurray
Copy link
Contributor

There is a precedent for the suggested "${workspaceFolder:rootA}..." notation. It is valid in debug configurations. See doc here and this code pointer:

private async evaluateSingleVariable(environment: Environment, match: string, variable: string, folderUri: uri | undefined, commandValueMapping: IStringDictionary<string> | undefined): Promise<string> {

@roblourens roblourens modified the milestones: Backlog, On Deck Dec 13, 2022
@andreamah andreamah assigned andreamah and unassigned roblourens Dec 15, 2022
@neilmenon
Copy link

Hmmm, there have been several requests for this feature but they all keep timing out due to lack of votes. Is there a way to unify all these and get enough votes to get this in?

@andreamah
Copy link
Contributor

Hmmm, there have been several requests for this feature but they all keep timing out due to lack of votes. Is there a way to unify all these and get enough votes to get this in?

This is already considered as a feature request and is in our backlog. Issues on the "Backlog Candidates" milestone are ones that are evaluated based on number of upvotes.

@Dtreschl
Copy link

If I am understanding the issue here properly, although not a complete fix, I've been able to exclude a root folder locally via a slightly hacky solution.

Adding the root folder in question (let's call it folder_1) to any of the VSCode search settings doesn't seem to remove it from the search, as noted above. And folder_1 contains many thousands of files, so it doubles my search load time. It's mostly got .c, .h, & .py files in it. To exclude those from my results, I put a .vscode folder into folder_1, and a settings.json inside of that with the following contents:
<root_dir/folder_1/.vscode/settings.json>
{ "search.exclude": { "**/*.c": true, "**/*.h": true, "**/*.py": true } }

My "files to include line" in my search editor is *.c, *.h, *.py , so by excluding those types from folder_1, they don't get included in my search results. Search time is halved, and it won't search for those file types within folder_1 any more. I admit, it's a hacky solution, as a repository with many file types would make this slightly clunky. But if anyone is looking for a temporary fix to this, hopefully I've been of help. It does not seem that you are able to just exclude **/*.*, at least on my end.

@starball5
Copy link

starball5 commented Jul 31, 2023

Somewhat related: #82145.

Somewhat related on VS Code: How can I exclude files from one of a multi-root workspace's root folders from search in VS Code?

@jcrben
Copy link

jcrben commented Dec 3, 2023

Does this also include files? I'm not having luck excluding a root file - package-lock.json.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities search Search widget and operation issues
Projects
None yet
Development

No branches or pull requests

14 participants