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

这是windows独有的功能吗?


当前回答

运行代码的步骤。命令启动VSCode应用程序-

打开VSCode 打开命令托盘(Cmd+Shift+P) 输入Shell命令:在PATH中安装'code'命令并选择 你会得到Shell命令'code'成功安装在PATH的通知。 重新启动终端并输入代码。 这将从其中的当前文件夹文件打开VSCode。

其他回答

很简单:

从命令行启动

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

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

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

在打开VSC并按下(Command + Up + P)后,我尝试输入“shell Command”,但什么都没有出现。为了得到“Shell Command: Install 'code' Command In PATH Command”,你必须执行以下命令:

按(Command, Up, P) 输入>(这将显示并运行命令) 然后在PATH命令中输入Shell命令:Install 'code'命令。然后它就会出现。 一旦你点击它,它会更新,你应该很好!

从命令行文档启动MacOS X

从Visual Studio代码设置页面:

Tip: If you want to run VS Code from the terminal by simply typing 'code', VS Code has a command, Shell Command: Install 'code' command in PATH, to add 'code' to your $PATH variable list. After installation, launch VS Code. Now open the Command Palette (F1 or ⇧+⌘+P on Mac) and type shell command to find the Shell Command: Install 'code' command in PATH command. After executing the command, restart the terminal for the new $PATH value to take effect. You'll be able to simply type 'code .' in any folder to start editing files in that folder.

试试这个

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

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

就是这样。

现在打开终端类型。

$ code。

如果你想在你的终端上打开Visual Studio Code上的文件或文件夹,下面的iTerm等命令是你安装Visual Studio Code时默认使用的命令

从命令行打开Visual Studio Code

code --

打开整个文件夹/目录

code .

打开特定的文件

code file_name
eg:- code index.html