vscode: Search all files (ctrl+shift+f) doesn't find results in files with very long filepaths unless opened in the editor
- VS Code Version: 1.53.1 5d424b828ada08e1eb9f95d6cb41120234ef57c7 x64
- OS Version: Windows 10 Pro - Build 19041
Steps to Reproduce:
- Make a new file with a very long filepath in vs code.
- When the file is not open in the editor, use ctrl+shift+f to search for any content in the file. No results appear.
- Open the file and search again. Results appear.
Specific steps to reproduce on Windows 10:
- Make a number of nested folders in windows explorer until this error appears:

- Add more nested folders/files to this directory using VS code.
- Make a txt file with a specific string in it and search for this string when the file is not opened in the editor.
The error seems to occur with filepaths exceeding the max filepath length of windows explorer.
Examples:
The bug in action:

Example Path: C:\Users<MY-USERNAME>\Desktop\long-named-foler-to-reproduce-bug-of-eternal-destruction\long-named-child-foler-to-reproduce-bug-of-eternal-destruction\long-named-child-foler-to-reproduce-bug-of-eternal-destruction\another-long-nameanother-long-nameanother-long-nameanother-long-name\deep.txt
Does this issue occur when all extensions are disabled?: Yes
Console output:

About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 14
- Comments: 31 (3 by maintainers)
I’ve enable long paths on Windows and restarted my computer, and the issue persists.
If I remember correctly I’ve encountered this issue before, 1+ year ago.
This issue becomes a big problem when one tries to “search and replace” something which has a lot of occurrences in a big project, e.g. changing an svg icon name. The above bug results in only parts of the app being changed, when it’s expected that everything should be changed.
It would be nice with at least a warning message when trying to use the search function on a project with long file paths, to prevent dangerous hard to finds bugs.
Even better would be full support for this 😃
Guys, I just stepped into this myself. I’m shocked that apparently I need to use different IDE to trust the search results. Is there any update on this issue after one year of investigations?
I don’t have long paths, I can only find a text with VS Code, if the file is opened in the editor. The setting
search only in opened filesis NOT enabled. Using grep or other IDEs allows for instant answer to my search. Searching functionality in VS Code appears very broken to me right now.Same issue. Can’t resolve it using @BrandonClapp approach, because the project itself has deep file structure. Those part (with long paths) is developed by another team using Mac, so they don’t have any issues. As a result, I forced to switch to Atom when I need to find something across the whole project.
If you want you can try the extension I made which can search in files with very long paths https://marketplace.visualstudio.com/items?itemName=carloblasi.vscode-search-long-paths
Is there any update?
I love vsCode. But looking for text in files in Atom
Please, help
Issue still persists for me on Mac
I am now using version 1.83.1 and it looks like the search is working with files with very long paths 🥳
I just ran into the same issue. It was working without any issues for years. I do not have long dir names. Search works in local env. It stopped working using SSH. I am not sure but I think the issue occurred after toggle the little book icon. I tried:
+1
If I use “files to include” (Shift+Alt+F) from “Explorer” panel, it can find a text in file with the full path more than 100 symbols. If I use global search - it doesn’t. So I use FAR for search if I had difficulties with VSC search. It’s still reliable.
Windows 10. VSC 1.63.2
We can investigate better supporting long paths in Windows but it’s likely to be a rather involved change. Until that happens, you can try the workaround suggested by @BrandonClapp here:
Open to PR’s if anyone is particularly passionate about this.
Duplicate of #116213. Do you know if you have opted into long paths on Windows? https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation#enable-long-paths-in-windows-10-version-1607-and-later
Also do you know if this was working in a prior release?