终端Visual Studio Code?"/>
如何添加节点终端Visual Studio Code?
我还没有成功,但是我重新安装了我的 Visual Studio 代码,并且无法再次向它添加节点终端。
请不要说我也可以使用 bash 运行并使用 powershell。这两个在 Vscode 中默认可以访问。
但是我想更改默认终端并更改为节点终端。不是 powershell 也不是 cmd ...
我在这个主题上搜索了很多网站,但找不到解决方案。有解决办法。我今天在 vs 代码中使用了节点终端。
所以我应该看到节点而不是 powershell 或 cmd。
对不起,如果解释很多,但我想非常清楚...
回答如下:有关 Visual Studio Code 中使用的all shell 类型的概述,请参阅this answer。
自定义外壳配置文件保存在
settings.json
文件中;要打开它进行编辑,请从命令面板 (Ctrl-Shift-P) 中选择
Preferences: Open Settings (JSON)
。
有特定于平台的属性名为
terminal.integrated.profiles.*
,其中*
是windows
、linux
或osx
(macOS)。
每个内部的属性定义shell配置文件,即可通过标记为+
(
每个shell-profile定义:
至少需要一个
参数来指定 shell 可执行文件的完整路径,或者仅在 Windows 上需要一个path
参数,它可以是source
或PowerShell
让 VS Code 找到合适的可执行文件.Git Bash
启动参数通过
指定。args
有关所有支持的属性,请参阅文档。
设置默认外壳配置文件:
Either:使用命令面板中的
命令:将显示所有已定义配置文件的列表;选择一个感兴趣的。Terminal: Select Default Profile
- 注意:单击每个配置文件右侧的齿轮图标 () 允许您定义一个 new 配置文件,它是 基于 突出显示的配置文件:系统会提示您为新配置文件命名,然后将其创建为突出显示的配置文件的copy。请注意,自 v1.59 起未采取进一步操作 - 您必须手动打开
文件进行编辑才能自定义新配置文件。settings.json
- 注意:单击每个配置文件右侧的齿轮图标 () 允许您定义一个 new 配置文件,它是 基于 突出显示的配置文件:系统会提示您为新配置文件命名,然后将其创建为突出显示的配置文件的copy。请注意,自 v1.59 起未采取进一步操作 - 您必须手动打开
或:将适合平台的
属性设置为所需外壳配置文件的名称。terminal.integrated.defaultProfile.*
示例:在 Windows 上将 Node.js (
node.exe
) 定义为自定义 shell 配置文件:
- 确定
的完整路径并通过加倍转义JSON的node.exe
字符;例如,从 PowerShell:\
# Get node.exe's full path, escape '\' chars., copy to the clipboard.
(Get-Command node.exe).Path.Replace('\', '\\') | Set-Clipboard
- 将以下内容添加到您的
文件中(如果settings.json
属性已经存在,只需 addterminal.integrated.profiles.windows
属性即可);该示例使用Node.js
的默认安装位置,node.exe
.C:\Program Files\nodejs\node.exe
"terminal.integrated.profiles.windows": {
"Node.js": {
"path": "C:\\Program Files\\nodejs\\node.exe",
"args": [] // Add startup arguments as needed.
}
},
// Make Node.js the default shell (if the property already exists, update its value).
"terminal.integrated.defaultProfile.windows": "Node.js",
更多推荐
如何添加节点终端Visual Studio Code?
发布评论