Kaj*_* VK 9 reactjs visual-studio-code
我想要一种从终端打开/创建文件的方法 - 使用相同的 VS Code 窗口。
如果我尝试使用终端发出以下命令,它将关闭当前窗口并打开一个新窗口。
code . nameofthefile.js -r --reuse-window
Run Code Online (Sandbox Code Playgroud)
然后,如果我正在运行 npm start - 前面的命令将杀死它。最重要的是 - 它将重新加载我的工作区,删除左栏资源管理器中的所有文件夹。
如果我只使用..
code . nomeofthefile.js
Run Code Online (Sandbox Code Playgroud)
是否可以在 VS Code 中使用终端命令打开新文件而不关闭当前文件?
Gha*_*chi 12
VSCode 命令行 ( code
) 能够根据您提供的路径打开文件夹和文件。如果您提供多个路径,它将打开所有路径。如果路径不存在,它将在该位置为您创建一个新文件。
# open current folder as workspace
code .
# open file.js in the last used workspace
code file.js # or
code -r file.js
# open file.js inside current folder as workspace
code . file.js
Run Code Online (Sandbox Code Playgroud)
因此,根据您提供的示例,您需要运行code nameofthefile.js
or
code -r nameofthefile.js
(它们似乎都做同样的事情)以免覆盖您当前的工作区。
归档时间: |
|
查看次数: |
11274 次 |
最近记录: |