文档中提到了一种叫做代码的可执行文件,但我不确定在哪里可以找到它,所以我可以把它放在我的路径上。我从VSCode网站下载的zip文件不包括任何这样的可执行文件。(我可以很好地运行.app。)

这是windows独有的功能吗?


当前回答

试试这个

打开Visual Studio Code,按Command + Shift + P,然后在命令面板中输入Shell,现在你可以找到这个选项,比如Shell命令:从命令面板中的建议列表中安装代码。选择该选项。

通过终端/命令提示打开VSCode

就是这样。

现在打开终端类型。

$ code。

其他回答

在我的情况下,我必须使用一个别名:

alias code="/<PATH TO VSCODE>/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code"

您可以在~/.bash_profile中添加这个别名。

链接你当前的文件夹到vscode。

Windows Registry Editor Version 5.00

; Directory\Background\shell => on empty space

[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode]
"Icon"="C:\\current-folder-vscode\\Code.exe,0"
@="VsCode"

[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command]
@="C:\\current-folder-vscode\\Code.exe ."

; Directory\shell => on a folder

[HKEY_CLASSES_ROOT\Directory\shell\vscode]
@="VsCode"
"Icon"="C:\\current-folder-vscode\\Code.exe,0"

[HKEY_CLASSES_ROOT\Directory\shell\vscode\command]
@="C:\\current-folder-vscode\\Code.exe ."

如果你正在使用可视代码内部,并且你想从你的终端或任何其他命令行工具在visual Studio code内部打开一个文件或文件夹,那么你可以参考下面的命令,这些命令在visual Studio code内部默认出现。

从命令行打开Visual Studio Code

code-insiders——

打开整个文件夹/目录

code-insiders。

打开特定的文件

code-insiders file_name

例:- code index.html

很简单:

从命令行启动

你也可以在终端运行VS Code,在将它添加到路径后输入' Code ':

启动VS代码。 打开命令面板(⌘P),输入'shell Command ',在PATH命令中找到shell Command: Install 'code'命令。

https://code.visualstudio.com/docs/setup/mac

只要更新你的python到python3.9,我这样做了,它为我工作。