VSCode + 远程 WSL 某些功能不起作用 [英] VSCode + remote WSL some functions not working

查看:50
本文介绍了VSCode + 远程 WSL 某些功能不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我通过右键单击项目文件夹在 VSCode 中打开一个 PHP 项目,则所有 PHP 功能都可以正常工作.如果我将鼠标悬停在一个对象或函数上,我会看到引用等.如果我右键单击,我有很多选项,例如转到定义、导入类...

If I open a PHP project in VSCode by right-clicking on the project folder, all the PHP functionality is working. If I hover on an object or function, I see the references, etc. If I do right click, I have many options like Go to Definition, Import Class ...

但是,如果我使用远程 WSL 打开项目,这些功能将不再起作用,并且在右键单击时,我没有以前拥有的大部分选项.此外,代码格式化程序不起作用.

Howeever, if I open the project with Remote WSL, these functions are not working anymore, and when doing a right click, I don't have most of options that I had before. Also, the code formaters are not working.

是否有任何解决方案可以让所有 VSCode 功能通过远程 WSL 运行?

Is there any solution to have all VSCode functions available working via Remote WSL?

我的开发环境是安装在 WSL2 上的 Docker 容器中的 DevilBox.

My dev environment is DevilBox which is installed in Docker Container on WSL2.

推荐答案

所以,我找到了这个问题的解决方案 :)

So, I found the solution to this issue :)

在 VSCode 中,我在本地安装了扩展.为了在 WSL 中工作,还需要在 WSL 中安装它们.

In VSCode I have the extensions installed locally. In order to work in WSL, is necessary to install them in WSL as well.

打开 WSL 远程连接并单击扩展时,VS Code 显示本地 - 已安装";和WSL:UBUNTU - 已安装".WSL 中不可用的本地安装的扩展变暗,并有一个绿色按钮在 WSL 中安装:.."

When opening a WSL remote connection and clicking on Extensions, VS Code shows "Local - Installed" and "WSL: UBUNTU - Installed". The Local Installed extensions which are not available in WSL are dimmed and have a green button "Install in WSL: .."

这篇关于VSCode + 远程 WSL 某些功能不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆