VS Code终端Select Default Profile功能失效 无内外终端选项显示
提问内容
我正在使用VS Code。
遇到的问题:终端的"Select Default Profile"功能无法正常工作,不显示任何类型的终端(包括内置终端和外置终端)。
我已参考官方文档指引进行操作。
我已经尝试过以下解决方案,均未生效:
- 重新安装VS Code
- 使用
terminal.integrated.shell.windows配置项(该配置已废弃但仍受官方支持) - 在settings.json文件中指定终端配置文件并设置为默认
- 移除所有自定义终端相关配置
当前我的settings.json配置内容如下:
{ "editor.formatOnPaste": true, "editor.formatOnSave": true, "editor.formatOnType": true, "typescript.updateImportsOnFileMove.enabled": "always", "editor.minimap.enabled": false, "git.suggestSmartCommit": false, "javascript.updateImportsOnFileMove.enabled": "always", "editor.suggestSelection": "first", "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", "files.exclude": { "**/.classpath": true, "**/.project": true, "**/.settings": true, "**/.factorypath": true }, }
请问我还遗漏了什么排查点?该如何解决这个问题?
问题现象截图:
我的VS Code版本信息如下:
Version: 1.61.0 (system setup) Commit: ee8c7def80afc00dd6e593ef12f37756d8f504ea Date: 2021-10-07T18:13:09.652Z Electron: 13.5.1 Chrome: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT x64 10.0.19043
排查与解决方案
你可以按照以下顺序排查剩余问题:
- 检查系统Path环境变量,确认你常用的终端路径已被正确添加,比如PowerShell对应的
C:\Windows\System32\WindowsPowerShell\v1.0\、cmd对应的C:\Windows\System32\,路径缺失会导致VS Code无法扫描到对应终端程序。 - 确认未禁用VS Code终端自动检测功能,检查settings.json中是否存在
terminal.integrated.profiles.windows被设置为空对象的残留配置,该配置会直接导致终端列表为空。 - 检查VS Code快捷方式的兼容性设置,不要勾选「兼容模式运行」或「以管理员身份运行」,权限或兼容模式异常会阻断VS Code扫描系统终端。
- 排查缓存损坏问题,完全关闭VS Code后,将
C:\Users\<你的用户名>\AppData\Roaming\Code和C:\Users\<你的用户名>\.vscode文件夹重命名备份,重启VS Code让其重新生成默认配置,排除本地缓存异常的影响。 - 检查是否给系统终端设置过自定义别名,别名会导致VS Code无法匹配到默认的终端程序。
如果排查后问题仍未解决,可以直接在settings.json中添加完整的终端配置强制指定终端:
"terminal.integrated.profiles.windows": { "PowerShell": { "source": "PowerShell", "icon": "terminal-powershell" }, "Command Prompt": { "path": [ "${env:windir}\\Sysnative\\cmd.exe", "${env:windir}\\System32\\cmd.exe" ], "args": [], "icon": "terminal-cmd" } }, "terminal.integrated.defaultProfile.windows": "PowerShell"
添加后重启VS Code即可正常显示终端列表。
内容的提问来源于stack exchange,提问作者Mauricio Gracia Gutierrez
相关产品推荐
相关产品推荐

