如何创建工作区 [英] How to create a workspace
问题描述
我们如何在 Visual Studio Code 中创建工作区?
How do we create a workspace in Visual Studio Code?
我看到文件菜单命令可以打开、添加文件夹和保存工作区,但没有创建工作区.
I see File menu commands to open, add a folder to and save a workspace, but nothing to create one.
问题我如何创建Visual Studio Code 中的工作区? 和 如何创建 Visual Studio Code Python 工作区? 特定于 Python.我在问如何创建通用工作区.
The questions How can I create a workspace in Visual Studio Code? and How can I create a Visual Studio Code Python workspace? are specific to Python. I am asking how to create a generic workspace.
问题Visual 中的工作区"是什么Studio Code? 提供了一些关于它们是什么的解释,但不清楚如何创建它们.
The question What is a 'workspace' in Visual Studio Code? provides some explanation of what they are, but it is not clear how to create them.
推荐答案
在要添加到工作区的文件夹中,创建一个文件 {foldername}.code-workspace
并在文件中放入在下面的代码中.
In the folder you want to add to your workspace, create a file {foldername}.code-workspace
and in the file put in the following code.
{
"folders": [
{
"path": "."
}
]
}
保存并关闭文件.返回 Visual Studio Code,单击菜单 File →打开工作区... 并选择您创建的 .code-workspace
文件,它会将其作为新工作区打开,而无需向现有工作区添加文件夹.
Save and close the file. Back in Visual Studio Code, click menu File → Open Workspace... and select the .code-workspace
file you created and it will open it as a new workspace without having to add a folder to an existing workspace.
这篇关于如何创建工作区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!