usernamehw / vscode-error-lens

VSCode extension that enhances display of errors and warnings.
https://marketplace.visualstudio.com/items?itemName=usernamehw.errorlens
MIT License
586 stars 32 forks source link

Feature Request: Select or Quickfix next problem by severity #208

Open zardoy opened 4 months ago

zardoy commented 4 months ago

Hello! Many users come from webstorm which has fix anything command (alt+enter) which focuses on the next problem and popups codefix UI. I could use the following keybinding for this:

"command": "runCommands",
"args": {
    "commands": [
        "editor.action.marker.next",
        {
            "command": "editor.action.codeAction",
            "args": {
                "kind": "quickfix",
                "apply": "never"
            }
        }
    ]
}

it was truly awesome experience but I didn't like the fact that it always selected the closest problem (warning and info) ignoring the severity level (even with "problems.sortOrder": "severity")

On the other hand errorLens.selectProblem (instead of editor.action.marker.next) with "errorLens.selectProblemType": "closestSeverity" works just perfectly, but once you run this command it won't go to the next problem (cycle). I wonder whether it is possible to implement an internal tracking of already focused problems and ignore them until the position of the cursor is not changed by the user. WDYT?

usernamehw commented 3 months ago

I'm thinking of adding 2 commands (no settings). errorLens.nextProblem & errorLens.prevProblem.

But how would it even work?

1❌ 2❌ 3⚠️

4⚠️

5❌ 6⚠️
// 500 lines of code
7❌ 8⚠️

Is the order of next problem 1 2 5 7 3 4 6 8 or something else? Does it target current file or all files?

zardoy commented 3 months ago

errorLens.nextProblem & errorLens.prevProblem

let's name them as errorLens.nextFileProblem & errorLens.prevFileProblem so it makes obvious

Is the order of the next problem 1 2 5 7 3 4 6 8

yes, you are absolutely right. and it doesn't matter what's your editor cursor position

zardoy commented 3 months ago

hey! i think i can help implementing this

usernamehw commented 3 months ago

Can you implement it without adding new settings? Just 2 commands that accept arguments e.g.:

{
    "key": "ctrl+shift+9",
    "command": "errorLens.nextProblem",
    "args": {
        "scope": "",// "file" | "allFiles"
        "sortOrder": "",// "problem" | "problemBySeverity"
        "diagnosticSeverity": [
            "error",
            "warning"
        ],
    }
},
zardoy commented 3 months ago

Can you implement it without adding new settings? Just 2 commands that accept arguments

Sounds good to me 👌