How to get VSCode command output on task problem matcher

814 Views Asked by At

I want to execute a custom VSCode command on a VSCode task. I need to catch the command output on problem matcher. What should I do on my custom VSCode command or problem matcher?

I tried to make a problem matcher. But it seems like doesn't work.

"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
        }
    ]
},

And here is my custom VSCode command:

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)
        })
    })
}

I would like to know how to let problem matcher catch the VSCode command log.Thanks!

0

There are 0 best solutions below