user7682158
user7682158

Reputation:

Is it possible to use the vscode: hyperlink to open a file or directory in Code?

In Visual Studio Code, you're able to use the vscode: hyperlink to complete some actions (i.e. vscode:extension/ericadamski.carbon-now-sh). Is there a way to use that to open a directory?

For example, I have my ~/Projects/Handbook directory, and I want to link to open/edit that on a Boostnote page using a hyperlink.

Upvotes: 35

Views: 25368

Answers (2)

Darwin
Darwin

Reputation: 2037

file:///c:/fullpath/filename

For files that locate in current directory:

file:///./filename

Upvotes: 1

Joao de Araujo
Joao de Araujo

Reputation: 1226

Yes, it is possible.

Open a project (or a directory)

vscode://file/{full path to project}/

vscode://file/c:/myProject/

Open a file

vscode://file/{full path to file}

vscode://file/c:/myProject/package.json

Open a file to line and column

vscode://file/{full path to file}:line:column

vscode://file/c:/myProject/package.json:5:10

More details: https://github.com/Microsoft/vscode-docs/blob/master/docs/editor/command-line.md#opening-vs-code-with-urls

Upvotes: 51

Related Questions