visual-studio-code

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.


Solution

  • 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