vscode-error-lens icon indicating copy to clipboard operation
vscode-error-lens copied to clipboard

Feature Request: Select or Quickfix next problem by severity

Open zardoy opened this issue 1 year ago • 6 comments

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?

zardoy avatar May 10 '24 10:05 zardoy

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?

usernamehw avatar May 15 '24 07:05 usernamehw

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 avatar May 15 '24 13:05 zardoy

hey! i think i can help implementing this

zardoy avatar Jun 01 '24 13:06 zardoy

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

usernamehw avatar Jun 01 '24 14:06 usernamehw

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

Sounds good to me 👌

zardoy avatar Jun 01 '24 16:06 zardoy

I would also like errorLens.nextFileProblem and errorLens.previousFileProblem. I'm coming from Neovim + LazyVim where you can hit "] d" for "next diagnostic" and "[ d" for previous diagnostic. VS Code editor.action.marker.next and editor.action.marker.prev are annoying me because they pop open this "peek" mode. I don't think VS Code has a way to navigate to the next problem without the annoying peek mode, which means my error shows up twice,

image

aguynamedben avatar Sep 17 '24 19:09 aguynamedben