在 VS Code 中分组的好处?
我最近开始了一门关于 c 语言编程的 Udemy 课程,当讲师详细介绍如何在 VS Code 中设置 ac 项目时,他必须浏览tasks.json 文件并添加以下代码。从一点点研究来看,似乎这是没有必要的,但我并不完全确定。如果有人能够详细说明 group>kind>build 和 isDefault>true 行的重要性,那就太棒了。
"group": {
"kind": "build",
"isDefault": true
正如我所说,我尝试做一些在线研究,但没有什么是清楚的,并且用一种“呃,你应该知道这一点”的语气来表达,这确实超出了我的理解。
附带说明一下,这是我在堆栈溢出问题上提出的第二个问题,我希望得到一些有关格式的反馈。
I recently started a Udemy course on programming in c, and when the instructor was detailing how to set up a c project in VS Code, he had as go through the tasks.json file and add the following code. From a little bit of research, it seems that this is not necessary, but I am not entirely certain. If anyone could elaborate on the importance of the group>kind>build and isDefault>true lines in general, that would be fantastic.
"group": {
"kind": "build",
"isDefault": true
As I said, I tried doing some online research, but nothing was clear, and was phrased in a "duh, you should know this", kind of tone, which really through off my understanding.
As a side note, this is my second ever question asked on stack overflow, and I would love some feedback on the formatting.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
VSCode 任务页面 或 任务架构页面,所以我也很困惑。这是我目前的理解(可能有一些漏洞!)
组的类型可以是
“test”
或“build”
。您的选择决定了任务的列出或运行位置。任务:运行测试任务
命令时,将列出/运行“测试”
任务。任务:运行构建任务
命令时,将列出/运行“构建”
任务。默认情况下,它还有一个键盘快捷键 cmd+shift+b (Mac) 或 ctrl-shift-b (Windows/Linux)。(在 Mac 上可以使用 cmd+shift+p 或在 Windows/Linux 上使用 ctrl+shift+p 显示命令面板。)
如果您只有一项特定类型的任务,或者有多个但只有一个具有
isDefault< /code> set,则在调用上述命令时运行该任务,否则会列出相关任务,您可以选择一个。在我的测试中,如果为同类的多个任务设置了
isDefault
,则它会被忽略。kind 可以作为唯一值提供,也可以使用特定的“
kind
”键提供:或者
使用第二种形式的原因是它允许您指定
isDefault
key 以及(参见上面的作用):This isn't particularly well documented on the VSCode Tasks page or tasks schema page, so I was confused too. Here's my current understanding (which may have some holes in!)
The group's kind can be either
"test"
or"build"
. Which you choose determine where the task is listed or run."test"
task is listed/run when you choose theTasks: Run Test Task
command from the command palette."build"
task is listed/run when you choose theTasks: Run Build Task
command from the command palette. By default, this also has a keyboard shortcut of cmd+shift+b (Mac) or ctrl-shift-b (Windows/Linux).(The command palette can be shown with cmd+shift+p on Mac or ctrl+shift+p on Windows/Linux.)
If you only have one task of a certain kind, or have multiple but only one has
isDefault
set, then that task is run when the command above is invoked, otherwise the relevant tasks are listed and you can choose one. In my testing,isDefault
is ignored if it's set for multiple tasks of the same kind.The kind can either be provided as the only value or with the specific "
kind
" key:or
The reason to use the second form is that it allows you to specify the
isDefault
key as well (see above for what that does):