'Visual Studio Code search across files (find in files) is not working
I am using Visual Studio Code 1.31.1 in MacOS 10.13.6. I open VSCode, I open a folder of text files, and I press command-option-F, or use Edit -> Find in Files. I search for a string that I know for sure exists in multiple text files in the open folder, and it says it can't find it.
Searching across files works if I have the folder open and have each and every single file open as a tab, which is rather pointless. Is there a way to search across files without actually having them all open as tabs?
I think it was because I opened a folder on Google Drive File Stream. It works fine on local files.
Solution 1:[1]
Had the same issue on Mac, seems like it was related to Google Drive. once I moved the files on my local drive the search worked fine.
Solution 2:[2]
Solution 3:[3]
Had this same issue, the search functionality was only working for files that were open in the editor. My issue was that VS Code had an update downloaded and ready to update, so I just restarted VS Code, let the update finish and the issue was gone.
Solution 4:[4]
Check out your vs code settings. It excludes some folders by default e.g. node modules.
Solution 5:[5]
Go to settings, search "Search" , there will be list to exclude folders. Remove item which might be accidentally got included, which might causing search item in all directory is not working.
Solution 6:[6]
It could be that the search is looking into all folders (including node_modules ones), so as it is too big, the search never ends
To fix that, you can list all folders that you want to exclude of the search, to do that, open your vscode settings (ctrl + ,) type "Search: Exclude" in the search box and add your folders. (Btw some are already added by default)
Besides, remember to enable that filter in your search, this is simple, just toggle on the gear button in your search section

If you are still not sure about what to do, take a look in this briefly gif

Solution 7:[7]
I had this problem today. Turns out I had a deprecated setting for advanced RegEx searches "search.usePCRE2": true, Once removed, search started working as expected.
Solution 8:[8]
I just had this problem on VS Code 1.58.2 / Mac OS 10.15.7
None of the above solutions worked for me, it still keeps saying 'No results found in open editors' no matter what I do.
But I did get it working by changing the 'Search: Mode' in the settings (for the workspace, or any other scope if needed) from 'view' to 'reuseEditor'.
Yes, this doesn't fix it if you really want the results in the Explorer tab rather than a completely new editor window, but it works.
Solution 9:[9]
I had an issue with searching in a project with git submodules and found that the gitlens add-on defaults to ignore searching any submodules:
Setting this to 2 or more may address your problem.
Solution 10:[10]
In my case, I had somehow gotten my Explorer set on a subfolder of my project. Closing VS Code and reopening the workspace reset everything and search worked again.
Solution 11:[11]
I had the same issue, i fixed mine by removing files in .gitignore
Solution 12:[12]
In my case, it was files with no extensions I was not able to find. Once I added those files an extension, I was able to find them via the search feature.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow



