简体   繁体   English

如何使用 vscode:// url 在 wsl 下的 vscode 中打开文件?

[英]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.我想使用vscode:// url在 WSL (Windows 子系统 Linux)下的 vscode 中打开一个文件

You can do it with a normal file in the usual filesystem vscode://file/c:/myProject/package.json您可以使用通常的文件系统vscode://file/c:/myProject/package.json中的普通文件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我想打开一个位于 WSL 中的文件,所以有这样的东西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在 Windows 中使用完整路径不起作用,因为它不启动 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您可以使用以下方案vscode://file//wsl$/Ubuntu-18.04
In your case it will be vscode://file//wsl$/Ubuntu-18.04/home/user/myProject/package.json在您的情况下,它将是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请参阅https://github.com/microsoft/vscode/issues/99691

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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