2023-04-26 21:31:30 -03:00
---
slug: /integrations/
2023-09-04 09:46:45 -03:00
sidebar_position: 8
2023-04-26 21:31:30 -03:00
---
2023-05-06 18:55:50 -03:00
# 集成
2023-04-26 21:31:30 -03:00
2023-05-06 18:55:50 -03:00
## Visual Studio Code 扩展
2023-04-26 21:31:30 -03:00
2023-05-06 18:55:50 -03:00
Task 有一个 [针对 Visual Studio Code 的官方扩展 ](https://marketplace.visualstudio.com/items?itemName=task.vscode-task )。 这个项目的代码可以在 [这里 ](https://github.com/go-task/vscode-task ) 找到。 要使用此扩展,您的系统上必须安装 Task v3.23.0+。
2023-04-26 21:31:30 -03:00
2023-05-06 18:55:50 -03:00
此扩展提供以下功能(以及更多):
2023-04-26 21:31:30 -03:00
2023-05-06 18:55:50 -03:00
- 在侧边栏中查看 task。
- 从侧边栏和命令面板运行 task。
- 从侧边栏和命令面板转到定义。
- 运行上一个 task 命令。
- 多根工作区支持。
- 在当前工作空间中初始化一个 Taskfile。
2023-04-26 21:31:30 -03:00
2023-05-06 18:55:50 -03:00
要获得 Taskfile 的自动完成和验证,请参阅下面的 [Schema ](#schema ) 部分。
2023-04-26 21:31:30 -03:00

## Schema
2024-01-10 22:19:58 -03:00
This was initially created by @KROSF in [this Gist ](https://gist.github.com/KROSF/c5435acf590acd632f71bb720f685895 ) and is now officially maintained in [this file ](https://github.com/go-task/task/blob/main/docs/static/schema.json ) and made available at https://taskfile.dev/schema.json. 这个 schema 可用于验证 Taskfile 并在许多代码编辑器中提供自动完成功能:
2023-04-26 21:31:30 -03:00
### Visual Studio Code
2023-05-06 18:55:50 -03:00
要将 schema 集成到 VS Code 中,您需要安装 Red Hat 的 [YAML 扩展 ](https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml )。 项目中的任何 `Taskfile.yml` 都应该被自动检测到,并且验证/自动完成应该可以工作。 如果这不起作用或者您想为具有不同名称的文件手动配置它,您可以将以下内容添加到您的 `settings.json` :
2023-04-26 21:31:30 -03:00
```json
// settings.json
{
"yaml.schemas": {
"https://taskfile.dev/schema.json": [
"**/Taskfile.yml",
"./path/to/any/other/taskfile.yml"
]
}
}
```
2023-05-06 18:55:50 -03:00
您还可以通过将以下注释添加到文件顶部来直接在 Taskfile 中配置 schema:
2023-04-26 21:31:30 -03:00
```yaml
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: '3'
```
2023-05-06 18:55:50 -03:00
您可以在 [YAML 语言服务器项目 ](https://github.com/redhat-developer/yaml-language-server ) 中找到更多相关信息。
2023-04-26 21:31:30 -03:00
2023-05-06 18:55:50 -03:00
## 社区集成
2023-04-26 21:31:30 -03:00
2023-05-06 18:55:50 -03:00
除了我们的官方集成之外,还有一个很棒的开发人员社区,他们为 Task 创建了自己的集成:
2023-04-26 21:31:30 -03:00
2024-01-10 22:19:58 -03:00
- [Sublime Text Plugin ](https://packagecontrol.io/packages/Taskfile ) [[source ](https://github.com/biozz/sublime-taskfile )] by @biozz
- [IntelliJ Plugin ](https://plugins.jetbrains.com/plugin/17058-taskfile ) [[source ](https://github.com/lechuckroh/task-intellij-plugin )] by @lechuckroh
2023-05-06 18:55:50 -03:00
- [mk ](https://github.com/pycontribs/mk ) 命令行工具本机识别 Taskfile。
2023-04-26 21:31:30 -03:00
2023-05-06 18:55:50 -03:00
如果你做了一些与 Task 集成的东西,请随意打开一个 PR 将它添加到这个列表中。