VS Code工作区如何仅保留WSL终端并移除其他终端选项
VS Code仅保留WSL终端的配置方法
- 打开VS Code的
settings.json配置文件,替换原有终端相关配置为以下内容:
{ // 全局默认终端设为WSL "terminal.integrated.defaultProfile.windows": "Ubuntu-20.04 (WSL)", // 任务、调试等自动化场景也强制使用WSL终端 "terminal.integrated.automationProfile.windows": "Ubuntu-20.04 (WSL)", // 关闭VS Code自动检测其他终端的特性 "terminal.integrated.automaticProfileDetection": "off", "terminal.integrated.profiles.windows": { "Ubuntu-20.04 (WSL)": { "path": "C:\\WINDOWS\\System32\\wsl.exe", "args": [] }, // 显式禁用所有内置终端,如还有其他显示的终端可在此处补充对应名称设为null "PowerShell": null, "Command Prompt": null, "Git Bash": null, "JavaScript Debug Terminal": null }, // 关闭终端配置提示弹窗 "terminal.integrated.showTerminalConfigPrompts": false }
- 保存配置文件后重启VS Code即可生效,终端下拉列表仅会显示你配置的WSL终端,所有场景触发的终端都会默认使用WSL。
如果有其他未消失的终端选项,可直接在终端列表右键对应项,选择「移除配置」即可删除。
内容的提问来源于stack exchange,提问作者SexyMF
相关产品推荐
相关产品推荐

