Dmitry Katson
Dmitry Katson

Reputation: 157

How to export all compilation errors and warnings from VSCode Problems view to txt/excel or similar?

Is there any opportunity to export all compilation errors and warnings from Problems view of VSCode to some tabular format?

If the number of errors is quite big, it's useful to analyse them somewhere, outside of VSCode.

Upvotes: 12

Views: 3459

Answers (2)

VonC
VonC

Reputation: 1323803

While not as easy than an export, VSCode 1.62 (Oct. 2021) does announce:

Copy multiple problems

You can now select and copy multiple problems in Problems view.

By selecting all the problems you need, you can now copy them in one operation, without having to install any plugin.

See issue 25290 and commit ae8175e

You can now select multiple problems and copy them:

select multiple prbs

You can also select the file/resource and copy all problems in that file:

select file

You can also copy all problem using the context menu in the empty area:

copy from context menu

Upvotes: 2

Mark
Mark

Reputation: 180825

This still isn't possible in vscode without an extension. So I published one:

Problems: Copy

You can copy all the problems in the workspace or for the current file. And these can be filtered to include/exclude Errors/Warnings/Informations/Hints.

Sample keybinding:

{
  "key": "alt+c",        // whatever keybinding you want
  "command": "problems-copy.copyAll",
  "args": {
    "errors": true,     // will be included in the result
    "warnings": true

    // any category not in the keybinding will be excluded from the result
    // "hints": true
    // "informations": true
  }
}

The output is added to the clipboard. Sample output:

[
    {
        "resource": "/c:/Users/Mark/folder-operations/extension.js",
        "code": {
            "value": "no-unused-vars",
            "target": {
                "$mid": 1,
                "path": "/docs/rules/no-unused-vars",
                "scheme": "https",
                "authority": "eslint.org"
            }
        },
        "severity": 1,
        "message": "'args' is defined but never used.",
        "source": "eslint",
        "startLineNumber": 32,
        "startColumn": 102,
        "endLineNumber": 32,
        "endColumn": 106
    }
]

I have plans to produce simpler output, including a csv version. What fields would you want in a csv or simple output?

Upvotes: 3

Related Questions