扩展可以在 VS Code 中贡献自定义任务吗? [英] Can extensions contribute a custom task in VS Code?
问题描述
我正在编写 VS Code 扩展.我想向用户的工作区贡献一个任务,而无需用户对其进行配置(理想情况下,取决于工作区的内容),而且我可能还需要一个自定义的 problemMatcher
.
I'm writing a VS Code extension. I want to contribute a Task to the user's workspace, without the user having to configure it (ideally conditionally, depending on the contents of the workspace), and I probably also need a custom problemMatcher
.
VS Code 是否公开了 API 来执行此操作?或者我应该编写自己的命令而不是任务?
Does VS Code expose an API to do so? Or should I be writing my own command instead of a task?
推荐答案
是的,VSCode 1.14(2017 年 6 月)中引入了用于贡献任务的 API.它的入口点是 vscode.tasks
命名空间.有关用法示例,请查看 task-provider-sample
在 vscode-extension-samples
中找到.
Yes, an API for contributing tasks was introduced in VSCode 1.14 (June 2017). The entry point for it is the registerTaskProvider()
method found in the vscode.tasks
namespace. For a usage example, check out the task-provider-sample
found in vscode-extension-samples
.
这篇关于扩展可以在 VS Code 中贡献自定义任务吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!