简体   繁体   中英

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.

在此处输入图片说明

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

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.

在此处输入图片说明

如果您知道文件名是 Ctrl+P,则打开当前项目中的已知文件。

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

在此处输入图片说明

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

在此处输入图片说明

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM