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:

  1. Make a new file with a very long filepath in vs code.
  2. When the file is not open in the editor, use ctrl+shift+f to search for any content in the file. No results appear.
  3. Open the file and search again. Results appear.

Specific steps to reproduce on Windows 10:

  1. Make a number of nested folders in windows explorer until this error appears: image
  2. Add more nested folders/files to this directory using VS code.
  3. 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: 2832acd2-2bfb-43e3-a0b0-be5867ba5f6e

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: image

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 14
  • Comments: 31 (3 by maintainers)

Most upvoted comments

findall If you have selected this book logo (in files to include field). Please deselect it. Then it will show all files. Hope this resolves your issue.

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 files is 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

Version: 1.87.2 (Universal)
Commit: 863d2581ecda6849923a2118d93a088b0745d9d6
Date: 2024-03-08T15:21:31.043Z
Electron: 27.3.2
ElectronBuildId: 26836302
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Darwin arm64 23.4.0

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:

  • updating vscode
  • uninstall/install ssh plugin
  • checking settings

+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:

I solved this with a symlink, but could have also just moved my repo closer to my drive. If anyone else has this issue…

  • Open command prompt (as administrator)
  • mklink /J “C:\Source” “C:\Some\Longer\Base\Path\Where\Your\Project\Is”
  • Reopen VSCode at the shorter path
  • Hope that your paths are under now under 255 characters

…or, you know, just chill out on your folder structure!

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?