3

我想在 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 命令日志。谢谢!

4

0 回答 0