如何在任务问题匹配器上获取VSCode命令输出

时间:2019-08-30 04:05:17

标签: typescript visual-studio-code vscode-extensions vscode-tasks

我想对VSCode任务执行自定义VSCode命令。我需要在问题匹配器上捕获命令输出。我应该对自定义VSCode命令或问题匹配器执行什么操作?

我试图做一个问题匹配者。但这似乎不起作用。

"problemMatcher": {
    "applyTo": "allDocuments",
    "owner": "vscode",
    "source": "Build",
    "severity": "error",
    "fileLocation": ["relative", "${workspaceFolder}"],
    "background": {
        "beginsPattern": "std",
        "endsPattern": "Built target",
        "activeOnStart": true
    },
    "pattern":[
        {
            "regexp": "Exit code: 2",
            "file": 1,
            "line": 2,
            "column": 3
        },
        {
            "regexp": "([A-Za-z0-9-]+):(.*)",
            "message": 2,
            "code": 1
        }
    ]
},

这是我自定义的VSCode命令:

export const build = (context: vscode.ExtensionContext, logger: FrontendChannelLogger): vscode.Disposable => {
    return vscode.commands.registerCommand('extension.build', async () => {
        return new Promise(async (resolve, reject) => {
            // Do something
            console.log(something)
        })
    })
}

我想知道如何让问题匹配者捕获VSCode命令日志。谢谢!

0 个答案:

没有答案