简体   繁体   中英

How to open a file in vscode under wsl using the vscode:// url?

I would like to open a file in vscode under WSL (Windows Subsystem Linux) using the vscode:// url.

You can do it with a normal file in the usual filesystem vscode://file/c:/myProject/package.json
It is clearly explained in the documentation

I would like to open a file which is located in WSL , so to have something like this vscode://file/home/user/myProject/package.json
But It does not work !

It does not work to use the complete path in windows as it does not start the WSL vscode vscode://file/C:\\Users\\john\\AppData\\Local\\Packages\\TheDebianProject.DebianGNULinux_76v4gqsdeaz4\\LocalState\\rootfs/home/user/myProject/package.json

You can use the following scheme vscode://file//wsl$/Ubuntu-18.04
In your case it will be vscode://file//wsl$/Ubuntu-18.04/home/user/myProject/package.json
But unfortunately file is opened in a new window.
Please see https://github.com/microsoft/vscode/issues/99691

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