简体   繁体   English

如何配置 vscode 以使用与 WSL 相同的 (linux) 文件路径格式?

[英]How do I configure vscode to use the same (linux) file path format as WSL?

The File->Open command will show Windows' Explorer dialog screen and thus uses Windows file path format, C:\abc\xyz . File->Open 命令将显示 Windows 的资源管理器对话框屏幕,因此使用 Windows 文件路径格式C:\abc\xyz However, I'd like the command to work with Linux file path, eg, /home/foo/test.py .但是,我希望该命令与 Linux 文件路径一起使用,例如/home/foo/test.py Is that possible?那可能吗? Thank you.谢谢你。

You need the vscode extension "Remote - WSL" installed which will enable a little green box in bottom left corner.您需要安装 vscode 扩展“Remote - WSL”,它将在左下角启用一个绿色小框。

Clicking it will give you the option to "Remote-WSL: Reopen Folder in WSL" |单击它将为您提供“Remote-WSL:在 WSL 中重新打开文件夹”选项 | Select WSL distro, eg Ubuntu. Select WSL 发行版,例如 Ubuntu。

note 1 - details on this is also covered in https://code.visualstudio.com/remote-tutorials/wsl/run-in-wsl注 1 - https://code.visualstudio.com/remote-tutorials/wsl/run-in-wsl中也介绍了这方面的详细信息

note 2 - it may not be required but i'm running with wsl2 tech preview update inplace [ "windows wsl2 docker setup" |注意 2 - 它可能不是必需的,但我正在使用 wsl2 技术预览更新就地运行 [“windows wsl2 docker 设置”| past year -> https://docs.docker.com/docker-for-windows/wsl-tech-preview/ ].过去一年-> https://docs.docker.com/docker-for-windows/wsl-tech-preview/ ]。 I have it in place to enable docker service to be hosted using new wsl vm versus outgoing hyper-v vm approach.我已经准备好启用 docker 服务以使用新的 wsl vm 与传出的 hyper-v vm 方法进行托管。 Don't think its required for vscode wsl integration to work.不要认为它需要 vscode wsl 集成才能工作。

在此处输入图像描述

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

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