How to quick search files in whole workspace (Visual Studio Code)
I'm asking for a method similar to Ctrl+P but that searchs in all workspace (but not in ignored foldres like node_modules
or .git
folders).
Ctrl+P searchs in recent opened list.
I am searching some way to type a file name (in a quick search way) and search files in all folders of the workspace (ignoring ignored folders).
Search by file name not by content.
short answer
Ctrl+P is the way for search file names in the current workspace or project.
but
- recently opened files are shown above.
- the quick search found files recently opened and files that are in the workspace or project but are not ignored
- ignored files may be ruled by
.gitignore
if insettings.json
"search.useIgnoreFiles"
istrue
.
That means that sometimes ignored files are found and sometimes not.
the solution to the question
- Change
settings.json
and set"search.useIgnoreFiles": false
. - Use Ctrl+P to search.
refs:
- https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options
- https://daveredfern.com/2017/hide-or-exclude-folders-and-files-from-search-in-visual-studio-code/
"search.useIgnoreFiles": false
What I found in VSC: There do not exists any real working "search file in folder explorer" !!
It works only advanced "Recently opened". It means: What you create, move inside VSC you can see in "search" result. But if you move, create something outside VSC you actually, won't see it in "search" result, like never existed.
Prove: You cant't "search" anything what was installed like libraries before you browse it physically in in vsc file explorer...
You can run into problems if you don't know how this feature work. It could cause problems, with the behavior of App, if there is file or not!
Also answers there are pretending search should be marked as dangerous, deprecated...
Goto settings, workbench.action.openSettings
,
"Preferences: Open Workspace settings" (F1)
- find setting:
search.exclude
- switch tab to
User
:- remove any unwanted items
- switch tab to
Workspace
:- remove any unwanted items (again).
- switch tab to
- save settings
- then
-
Show all commands
(F1) -
Goto File ...
(Ctrl-P)
-
Then you'll find the file in the workspace Your're searching for.
(set the search.useIgnoreFiles
setting accordingly as needed, once for each: User and Workspace)