Vscode: Find in Folder not working if the folder is excluded in setting

Created on 19 Feb 2019  路  9Comments  路  Source: microsoft/vscode


  • VSCode Version: 1.31.1
  • OS Version: mac

Steps to Reproduce:

  1. Right click the node_modules folder in left sider bar and selct Find in Folder
  2. Search some text that existed in node_modules folders
  3. Be sure in settings.json, the node_modules need to be excluded
  4. can not search any result.

The version before 1.31.1, also exclude node_modules, but If use Find in Folder and select node_modules, It can search the correct result.


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

feature-request search

Most helpful comment

image
Sorry, it is the button of 'Use Exclude Setting' selected, unselected it and the search works fine.

I close this issue by myself.

All 9 comments

image
Sorry, it is the button of 'Use Exclude Setting' selected, unselected it and the search works fine.

I close this issue by myself.

I'd like to reopen this as the behaviour is not obvious at all. I had to dig around GH to figure this out and almost logged the same bug you just had.

If I go to 'Find in Folder..." specifically, it should definitely find in that folder no matter what the settings say. It's an explicit action.

@CommerceOwl Yes. You are right, the behaviour of 1.31.1 is not same as previous versions. I agree to reopen this issue. I will reopen it.

This is harder than it sounds, when exactly should we ignore the exclude settings? What if you search in a folder that only contains .js files, and settings say to exclude *.js? Or if you search in foo and settings say to exclude f*/**? I think that trying to decide which settings apply or don't apply in some scenario will just be even more confusing.

If you search in foo, then foo folder should definitely be searched. Excluding *.js is a bit more tricky.

Instead of talking hypnotically, let me mention the use case that got me to waste a bunch of time trying to debug this.

I have node_modules/ in my .gitignore. I know that node_modules don't appear in regular search and it's beautiful since the folder is greyed out as well. I get that. However, I expected me going to node_modules/draft-js/ and right clicking and going "Find in folder..." should definitely find in that folder or if it's not going to, tell me that instead of misleading me with no results (which I believed it a few times).

So, perhaps if the user engages the Find dialog through "Find in folder..." menu, if there's an explicit path set to ignore that folder, show a message or even disable "Find in folder..." menu?

Update: Perhaps wildcard matches can be show in "files to exclude" field

I think the experience could be improved. Settings are one thing, gitignore is yet another, currently
vscode does not read the gitignore file and ripgrep does not provide a way for us to apply some .gitignore patterns and disregard others.

Never mind about .gitignore. I thought that's what it had picked up and didn't realize it was a hard setting.

If a user explicitly overrides a glob that excludes results, we should either allow the find in folder to be the ultimate source of truth (I think it should be by default, instead of the other way around), or show the user a message indicating "the path you're searching within is excluded by your settings, click the gear icon above to toggle this off temporarily".

As a bonus feature, there are potential conflicts of the "search: exclude" setting, so allowing a user to selectively disable those exclusions when "find[ing] in folder" would be great.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

biij5698 picture biij5698  路  3Comments

DovydasNavickas picture DovydasNavickas  路  3Comments

shanalikhan picture shanalikhan  路  3Comments

sijad picture sijad  路  3Comments

sirius1024 picture sirius1024  路  3Comments