user189198
user189198

Reputation:

VSCode: Open file in project

I'm using Mac OS X with Visual Studio Code 0.10.10.

How do I use the keyboard to open a file, using its partial name, in the currently open project? I can't find a command in the Command Palette that would enable me to do this. There is a command that does this for Working Files (see screenshot), but not for the currently open project.

enter image description here

Upvotes: 24

Views: 24610

Answers (5)

Rustem Kakimov
Rustem Kakimov

Reputation: 2671

> prefix is for running commands in VSCode.

To open a file in the current project press Cmd ⌘ + P and type the full / partial name of the wanted file. VSCode uses fuzzy search, so you can even get away with typos in your input.

Upvotes: 47

Pekke
Pekke

Reputation: 9

Ctrl+O opens the command palette right to the file search mode. The command in the shortcuts is "workbench.action.files.openLocalFile".

Upvotes: -1

DevLoverUmar
DevLoverUmar

Reputation: 13923

Open file opening pallet with ctrl+p (on Windows) and cmd+p on Mac OSX.

enter image description here

In that pallet you can either type the file name or a file relative path like shown in the below image

enter image description here

The important point for relative path is that, it should not start with a dot . but should start with a fwd slash /

Absolute path can be used as well.

Upvotes: 0

Naresh N
Naresh N

Reputation: 51

To open known file on a current project if you aware the file name is Ctrl+P Windows.

Upvotes: 5

WebFreak001
WebFreak001

Reputation: 2523

There is not a proper command for this but if your file has any file extension you can just open the command palette and replace the > with a .

It will have a section of the open files at the top and "file and symbol results" at the bottom containing every file name containing a . (= all files with a file extension)

If you know the name of the file you can simply remove the > in the command palette and type the name and it will show the file and symbols results again for any file containing what you have typed.

enter image description here

Upvotes: 9

Related Questions