Skip to content

Select all errors in file

losnappas edited this page Dec 25, 2022 · 1 revision

Creates selections around all errors in the file (as reported by problems view).

  {
    "key": "ctrl+alt+n",
    "command": "dance.run",
    "when": "editorTextFocus && dance.mode == 'normal'",
    "args": {
      "input": [
        "const activeEditor = vscode.window.activeTextEditor;",
        "const diags = await vscode.languages.getDiagnostics(activeEditor.document.uri);",
        "const errs = diags.filter(d => !d.severity);",
        "const sels = errs.map(e => new vscode.Selection(e.range.start, e.range.end))",
        "Selections.set(sels)"
      ]
    }
  }