博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
VS Code中的“工作区”是什么?
阅读量:3583 次
发布时间:2019-05-20

本文共 4558 字,大约阅读时间需要 15 分钟。

本文翻译自:

I can't quite believe I am asking this question, but I have not been able to find a definition in the documentation. 我不敢相信我在问这个问题,但我无法在文档中找到定义。 In case it isn't painfully obvious, I am (very) new to VS Code. 如果不是很明显,我(非常)是VS Code的新手。

For example, VS Code talks about . 例如,VS Code讨论了 。

On the one hand, 一方面,

  • (a) it could refer to a project directory that you have opened; (a)它可以指你打开的项目目录; or 要么
  • (b) it could refer to everything you have opened in a particular window. (b)它可以指在特定窗口中打开的所有内容。

The page referenced above says 上面引用的页面说

"Workspace: These settings are stored inside your workspace in a .vscode folder and only apply when the workspace is opened."

#1楼

参考:


#2楼

On some investigation, the answer appears to be (a). 在一些调查中,答案似乎是(a)。

When I go to change the settings, the settings file goes into a .vscode directory in my project directory. 当我去更改设置时,设置文件进入我的项目目录中的.vscode目录。


#3楼

You can save settings at the workspace level and you can open multiple folders in a workspace. 您可以在工作区级别保存设置,并可以在工作区中打开多个文件夹。 If you want to do either of those things, use a workspace, otherwise, just open a folder. 如果要执行上述任一操作,请使用工作区,否则只需打开文件夹即可。

A VS Code workspace is a list of a project's folders and files. VS Code工作空间是项目文件夹和文件的列表。 A workspace can contain multiple folders. 工作区可以包含多个文件夹。 You can customize the settings and preferences of a workspace. 您可以自定义工作区的设置和首选项。


#4楼

A workspace is just a text file with a (.code-workspace) extension. 工作空间只是一个带有(.code-workspace)扩展名的文本文件。 You can look at it by opening it with a text editor. 您可以通过使用文本编辑器打开它来查看它。 I too was frustrated by the idea of a workspace and how it is implemented in VS Code. 我也对工作空间的概念以及如何在VS Code中实现它感到沮丧。 I found a method that suits me. 我发现了一种适合我的方法。

Start with a single "project" folder. 从单个“项目”文件夹开始。

Open VSCode and close any open workspaces or files or folders. 打开VSCode并关闭所有打开的工作区或文件或文件夹。 You should see only "OPEN EDITORS" and "NO FOLDER OPENED" in the EXPLORER. 您应该只在EXPLORER中看到“OPEN EDITORS”和“NO FOLDER OPENED”。

From the Menu Bar --> File --> Open Folder... . Menu Bar --> File --> Open Folder... Navigate to where you want to put your folder and right click to open a new folder. 导航到要放置文件夹的位置,然后右键单击以打开新文件夹。 Name it whatever you want, then click on " Select Folder ". 将其命名为您想要的任何名称,然后单击“ Select Folder ”。 It will appear in the VS Code EXPLORER . 它将出现在VS Code EXPLORER

Now from the Menu Bar --> File --> Save Workspace As... . 现在从Menu Bar --> File --> Save Workspace As... Name the workspace and save it wherever you want to keep all your workspace's, (not necessarily where your project folders are). 命名工作区并将其保存在您想要保留所有工作区的位置(不一定是项目文件夹所在的位置)。 I put all mine in a folder called "VS Code workspace". 我把我的全部放在一个名为“VS Code workspace”的文件夹中。

It will be saved as a ( .code-workspace ) file and is just an index to all the files and folders it contains (or points to) wherever they may be on your hard drive. 它将保存为( .code-workspace )文件,并且只是它包含(或指向)所有文件和文件夹的索引,无论它们位于硬盘驱动器上的哪个位置。 You can look at it by opening it with a text editor. 您可以通过使用文本编辑器打开它来查看它。 Close the folder you created and close VS Code. 关闭您创建的文件夹并关闭VS Code。

Now find your workspace "file" and double click on it. 现在找到您的工作区“文件”并双击它。 This will open VS Code with the folder you created in your workspace. 这将使用您在工作区中创建的文件夹打开VS Code。 Or you can open VS Code and use "Open Workspace". 或者您可以打开VS Code并使用“Open Workspace”。

Any folders you create from within your VS Code workspace will be inside your first folder. 您在VS Code工作区中创建的任何文件夹都将位于第一个文件夹中。 If you want to add any more top level folders, create them first wherever you want them and then use " Add To Workspace.. " from VS Code. 如果要添加任何更多顶级文件夹,请先在任意位置创建它们,然后使用VS Code中的“ Add To Workspace.. ”。


#5楼

The main utility of a workspace (and maybe the only one) is to allow to add multiple independent folders that compounds a project. 工作空间(也许是唯一的)的主要功能是允许添加多个独立的文件夹来组合项目。 For example: 例如:

- WorkspaceProjectX  -- ApiFolder   (maybe /usr/share/www/api)  -- DocsFolder  (maybe /home/user/projx/html/docs)  -- WebFolder   (maybe /usr/share/www/web)

So you can group those in a work space for a specific project instead of have to open multiple folders windows. 因此,您可以将工作空间中的那些分组为特定项目,而不必打开多个文件夹窗口。

You can learn more . 你可以了解更多。


#6楼

As of May 2018, it seems that workspace in VS Code allows you to have quick access to different but related projects. 截至2018年5月,似乎VS Code中的工作区允许您快速访问不同但相关的项目。 All without having to open a different folder. 所有这些都无需打开不同的文件夹。 And you can have multiple workspaces too. 而且您也可以拥有多个工作区。 See references here and you will get the full picture of it: 请参阅此处的参考资料,您将全面了解它:

转载地址:http://umlgj.baihongyu.com/

你可能感兴趣的文章
N2-审计方法与步骤
查看>>
N3-常见的INI配置
查看>>
代码审计 N4 常见危险函数和特殊函数(一)
查看>>
MySQL笔记
查看>>
计算机运算方法之(原码 补码 反码 移码)
查看>>
计算机组成原理之(二进制与十进制互相转换,数的定点表示与浮点数表示)例题:设浮点数字长16位,其中阶码5位(含有1位阶符),尾数11位(含有1位数符)
查看>>
选择排序(java代码实现)
查看>>
插入排序
查看>>
哈夫曼树java代码实现
查看>>
快速排序
查看>>
vue路由高亮的两种方式
查看>>
vue router 报错: Uncaught (in promise) NavigationDuplicated {_name:""NavigationDuplicated"... 的解决方法
查看>>
vue跳转页面的两种方式
查看>>
存储器题目解析(持续更新中....)
查看>>
存储器知识要点
查看>>
Cache模拟器的实现
查看>>
设计模式七大原则
查看>>
SpringBoot入门(二)场景启动器
查看>>
SpringBoot入门--自动配置
查看>>
自动配置原理
查看>>