44

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.

Emilio Platzer
  • 1,547
  • 2
  • 15
  • 23
  • What about (1) Menu Edit, Find in Files (Ctrl+Shift+F) to search the Currently open Folder, or (2) Go to Explorer (Ctrl+Shift+E), right click the folder and select "Find in folder". – harrymc Oct 14 '18 at 13:17
  • "Find in Files" search a text in the content of the files. I am looking for a way to search files by file name. I will edit the question to be more accurate. – Emilio Platzer Oct 14 '18 at 13:39
  • I don't know how to search only for a file-name in Visual Studio Code. Why don't you use a product that excels in such searches like [Everything](https://www.voidtools.com/). – harrymc Oct 14 '18 at 13:50
  • The problem of using a general product (like TotalCommander) is that it doesn't knows about VSC configurations (i.e. excluded folders). Ctrl P exists (search file names in recent file opened), then the existence of a search in the whole workspace or project sounds possible (and it will be more comfortable). – Emilio Platzer Oct 14 '18 at 14:55
  • I'm not sure you will get many hits in the excluded folders, and you can also exclude them in Everything. – harrymc Oct 14 '18 at 16:16
  • Currently if I checkout https://github.com/codenautas/backend-plus, I install it, and I search for package.json, I found only one in the root folder and 631 ocurrences in node_modules (ignored folder). The idea of quick search is to not have to type all the name (in the same example if I will type "config" I will find more entries in node_modules). – Emilio Platzer Oct 14 '18 at 20:23

3 Answers3

55

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 in settings.json "search.useIgnoreFiles" is true.

That means that sometimes ignored files are found and sometimes not.

the solution to the question

  1. Change settings.json and set "search.useIgnoreFiles": false.
  2. Use Ctrl+P to search.

refs:

Emilio Platzer
  • 1,547
  • 2
  • 15
  • 23
1

"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...

1

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).
  • 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)

Hartmut Pfarr
  • 482
  • 1
  • 4
  • 12