How do I search for files in Visual Studio Code?

Visual Studio-CodeKeyboard Shortcuts

Visual Studio-Code Problem Overview


I am used to Resharper where I can search for files, not the content, but the filename, which makes it quick to open new files.

Is this feature implemented in Visual Studio Code and is there a shortcut for it?

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

Using Go to File... which is under the Go menu or using keyboard shortcut:

  • On Windows Ctrl+p or Ctrl+e
  • On macOS Cmd ⌘+p
  • On Linux Ctrl+p or Ctrl+e

Then type the file name.

Also be sure to checkout that you can set your own keybindings and that there are cheatsheets available for Windows, macOS and Linux.

Solution 2 - Visual Studio-Code

On OSX, for me it's cmd ⌘ + p. cmd ⌘ + e just searches within the currently opened file.

Solution 3 - Visual Studio-Code

If you want to see your files in Explorer tree...

when you click anywhere in the explorer tree and start typing something on the keyboard, the search keyword appears in the top right corner of the screen : ("module.ts")

enter image description here

And when you hover over the keyword with the mouse cursor, you can click on "Enable Filter on Type" to filter tree with your search !

Solution 4 - Visual Studio-Code

Win: CTRL+P or CTRL+E

Mac: CMD+P or CMD+E


Don't want to remember another shortcut?

Open the Command Palette:

  • Menu: View -> Command Palette
  • Windows Shortcut: Ctrl+Shift+P

and hit backspace to delete ">" character and then begin typing to search for files via filename. :)

Solution 5 - Visual Studio-Code

Other answers don't mention this command is named workbench.action.quickOpen.

You can use this to search the Keyboard Shortcuts menu located in Preferences.

On MacOS the default keybinding is cmd ⌘ + P.

(Coming from Sublime Text, I always change this to cmd ⌘ + T)

Solution 6 - Visual Studio-Code

Also works in ubuntu with Ctrl+E

Solution 7 - Visual Studio-Code

You can also press F1 to open the Command Palette and then remove the > via Backspace. Now you can search for files, too.

Solution 8 - Visual Studio-Code

I'm using VSCode 1.12.1

OSX press : Cmd + p

Solution 9 - Visual Studio-Code

consider you have thousand of files in vs code and you want to search for a file with particular name then

  1. Right click VS code editor.
  2. Select Command Palete
  3. In the text box type the file name

enter image description here

enter image description here

Solution 10 - Visual Studio-Code

If you just want to search a single file name

Just Ctrl+P, then type and choose your one

If you want to open all files whose name contains a particular string

  1. Open search panel
  2. Put any common words inside those files
  3. in 'files to include', put the search string with *, e.g. *Signaller*

enter image description here

Solution 11 - Visual Studio-Code

Method1

  1. Go->Go to File OR cntrl+p
  2. Search your file

enter image description here

Method2

  1. view->command palette OR cntrl+shift+p
  2. type "Go to file"
  3. Search your file

enter image description here

Solution 12 - Visual Studio-Code

For windows. if Ctrl+p doesn't always work use Ctrl+shift+n instead.

Solution 13 - Visual Studio-Code

The problem with Ctrl+P (or Cmd+P) is that it searches your workspace while ignoring files and folders set in the .gitignore file. To change this behavior, add "search.useIgnoreFiles": false in your settings.json file under .vscode directory.

NOTE that search.exclude and files.exclude settings will override this. So, in your settings.json file, you should comment them out or set these two settings to false as well if you want to search all the files and directories in your VS Code project. An example for settings.json where search.exclude and files.exclude are commented out for searching all the files:

{
    "search.exclude": {
        //"**/Lib": true,
        //"**/Scripts": true
    },
    "files.exclude": {
        //"**/Lib": true,
        //"**/Scripts": true
    },
    "search.useIgnoreFiles": false
}

Look here for more info.

Solution 14 - Visual Studio-Code

To search for specifil file types in visual studio code.
Type ctrl+p and then search for something like *.py.

Simple and easy

Solution 15 - Visual Studio-Code

If using vscodevim extension, ctrl + p won't work so I saw another answer using:

ctrl + shift + p

which opens the command palette. Hit backspace to remove the '>' and then start typing your filename.

Solution 16 - Visual Studio-Code

Check your settings for 'Use Ignore Files' and 'Use Global Ignore Files'. If these are checked, VSCode won't search any folders listed in .gitignore or .ignore

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDofsView Question on Stackoverflow
Solution 1 - Visual Studio-CodeMikeView Answer on Stackoverflow
Solution 2 - Visual Studio-Codenikk wongView Answer on Stackoverflow
Solution 3 - Visual Studio-CodeA. MorelView Answer on Stackoverflow
Solution 4 - Visual Studio-CodeGorvGoylView Answer on Stackoverflow
Solution 5 - Visual Studio-CodeJLFView Answer on Stackoverflow
Solution 6 - Visual Studio-CodeWender Alves LibórioView Answer on Stackoverflow
Solution 7 - Visual Studio-Codeochs.tobiView Answer on Stackoverflow
Solution 8 - Visual Studio-CodeGiangView Answer on Stackoverflow
Solution 9 - Visual Studio-CodeSiddarth KantedView Answer on Stackoverflow
Solution 10 - Visual Studio-CodeXinView Answer on Stackoverflow
Solution 11 - Visual Studio-CodelavaView Answer on Stackoverflow
Solution 12 - Visual Studio-CodeMonirRouissiView Answer on Stackoverflow
Solution 13 - Visual Studio-Codeshaheen gView Answer on Stackoverflow
Solution 14 - Visual Studio-CodeVinod KumarView Answer on Stackoverflow
Solution 15 - Visual Studio-CodeYing n YangView Answer on Stackoverflow
Solution 16 - Visual Studio-CodePeter KoopmanView Answer on Stackoverflow