microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.74k stars 29.46k forks source link

Go to next error/warning/info #105795

Open torkelrogstad opened 4 years ago

torkelrogstad commented 4 years ago

I'd love a feature where I could go to the next error in the file I'm in, or in the entire project, but not the next warning/info marker. Currently I have these shortcuts available:

I think it'd make a lot of sense to expose similar shortcuts for going to the next error, or the next warning, or the next info, but as separate groups.

Example use case: I have a spell checker and a linter enabled for my project. The linter produces both warnings and errors, and the spell checker produces info markers. I care mostly about linter errors and compiler errors, and when those are fixed I care about spelling errors.

danielo515 commented 3 years ago

100% agree Or if you can focus on the "error provider" of your choice that will be ideal: just next error coming from eslint, next error coming from typescript, etc.

mellester commented 3 years ago

It would be nice if we could define something like this

    {
        "key": "f4",
        "command": "editor.action.marker.next",
        "args": "Error|Warn"
    }

And it would skip the Info markers

chrisnevers commented 3 years ago

Are there any plans to implement this feature?

rcdailey commented 3 years ago

I don't think this needs extra configuration. Why can't Next/Previous Problem respect the current filter set in the Problems view? Basically if a problem is filtered out, skip it when doing Next Problem keyboard shortcut.

danielo515 commented 3 years ago

I don't think this needs extra configuration. Why can't Next/Previous Problem respect the current filter set in the Problems view? Basically if a problem is filtered out, skip it when doing Next Problem keyboard shortcut.

That makes a lot of sense

PabloLION commented 2 years ago

IMHO, both adding a new command or passing args to the current one are good. I searched the market and there's none. Maybe someone can make an extension for this?

yy0931 commented 2 years ago

I made a VSCode extension because I've also been having trouble with this. https://marketplace.visualstudio.com/items?itemName=yy0931.go-to-next-error

PabloLION commented 2 years ago

https://marketplace.visualstudio.com/items?itemName=yy0931.go-to-next-error

I tested this extension by @yy0931 and it's quite good! And very thoughtful to write the full guide. 5 stars! I reckon this issue is ready to be closed for being solved.

Yazir commented 2 years ago

It would be much appreciated if it was already a feature of vscode itself

i-am-the-slime commented 2 years ago

Very sad somebody had to write an extension for this.

mtone commented 2 years ago

In Jetbrains IDEs "Next Error" loops through all errors across all files, and only when there are no longer any errors, loops through all warnings, etc. I quite like this behaviour and it might address or complement the scenario in this issue.

However it doesn't appear possible in VsCode:

My typical scenario: adding a required member to the TS interface of a React component props always causes errors in the parent component files. I'd press {key} to navigate to those right next -- which might over multiple files, possibly with warnings -- so that I can build again, then keep using {key} to navigate to warnings from the current location.

In short I suggest that when when problems.sortOrder = 'Severity':

JeanMeche commented 1 year ago

FYI you can do F8 to jump next/previous error.

starball5 commented 1 year ago

Related Stack Overflow question: How do I go to the next error (not next problem) in using a keyboard shortcut?

alexpovel commented 1 year ago

As this issue mentions a spell checker as an example, and I found this thread while dealing with that same issue: here's another solution. This pertains to Code Spell Checker aka streetsidesoftware.code-spell-checker. It comes with an option diagnosticLevel, which is Information by default, and will subsequently show in the Problems pane and be subject to Go to next error/warning/info commands. The level can be set to Hint, removing the extension's info from the Problems pane. Go to next error/warning/info then works as expected and doesn't jump to typos anymore.

This is what the Hint level then looks like (bottom left):

image

So perhaps, as a workaround, see if your extension supports adjusting its reporting level (which doesn't solve the underlying issue of course, a solution to which I'd still prefer over this approach).

darianmorat commented 10 months ago

Or also having the option of going to the next error avoiding the message and just jumping directly to the error. I use Error Lens and it shows the msg 2 times.

rettoua commented 4 weeks ago

Any solution for that w/o extension/plugins etc?