Vscode: Request: Linter messages are shown without mouse hover

Created on 14 Mar 2016  路  37Comments  路  Source: microsoft/vscode

When the linter found something in code, a red-wave-line is shown at that part of the code.
I can read the message from the linter by moving a mouse cursor to there, or pressing Ctrl+Shift+M.
But, I hope the message that can be read without moving mouse or command. For example, the message about a current line is shown in a status bar.

feature-request ux

Most helpful comment

For completeness: There is also F8 that shows the next error.

@anseki Is your request to show the error message in the status line when the cursor is at that location?

All 37 comments

For completeness: There is also F8 that shows the next error.

@anseki Is your request to show the error message in the status line when the cursor is at that location?

Sorry, my English is poor.
I mean, a cursor that is moved by keys points the "current line", not a mouse cursor (pointer).
I hope that, when that line includes problems that are found by linter, the messages by linter about that line are shown in the status bar.

If the message is shown in the status bar such as Sublime Text, IntelliJ, Atom Linter, etc., I can know the reason immediately without additional operation, when I am typing.
Those are shown automatically, but I like the bottom of window such as the status bar than a popup.

@stevencl @bgashler1

The request is to show error messages in the status bar on cursor move. I have mixed feelings about that, can you please chime in.

Could this not be done as extension? Sounds doable.

(but maybe API is missing to get the error messages at cursor location)

One of the things that we have tried to do is to design the experience so that the user can stay focused on their code as much as possible and does not need to look elsewhere for information about the code that they are reading. Hence we use the peek widget liberally to show definitions, references, errors etc in context, right inside the editor. So my initial reaction is that putting information about errors in the status bar contradicts our approach a little.

I understand the appeal of this suggestion though as it doesn't require the user to invoke any command. But in some way it goes against our principle of keeping the user focused on their code inside the editor.

Thinking out loud, what if we were to show a message in the status bar telling the user how to invoke the inline error display whenever the cursor is on some text where there is an error? It still requires an extra keystroke but it helps the user discover the functionality and then allows them to more easily navigate through errors. It also helps whenever the error message is too long to display in the status bar.

I was looking for the same but then I agree with @stevencl, pressing F8 is a much better solution.

Discoverability of keyboard shortcuts could be improved potentially here and certainly elsewhere. I favor @stevencl approach of helping users discover these shortcuts in the context of where they could be relevant, and applying this to other areas of the product. This is an experience we should design that could help users improve their productivity and ease of use throughout the product.

@anseki, I noticed that Atom and Sublime do not include your requested feature by default, but they are installable through optional packages/extensions. To @bpasero's point, I think an extension makes perfect sense for people who would really like to see this particular feature. How hard would it be to get this API?

At least, SublimeLinter and Linter (not Atom-Lint) show error messages in the status bar (or the bottom of the window) by default.
And IntelliJ and some editors also do by default (if I remember correctly).

Anyway, I was inured to editors that show error messages in the status bar. But, now, I understand that approach of VS Code and the convenience of F8 key.
That still requires additional operation, but it is just a little bit. I think that I am inured to that soon.

Thank you all, for your time.

I'd be interested in an extension that behaves like @anseki asked for, particularly surfacing the next issue from the cursor.

As helpful as the f8 function is, MacOS users might need to hold down an additional key (which isn't used very often) which breaks the focus from the code (as I hunt for the fn key). But that's okay since I can rebind the key.

However, pressing ESC to get out of that context is a bit frustrating too, it turns a quick glance into a three-key combo.

Not suggesting it's a default, but an alternative would be nice. Maybe even just a hold-to-reveal-errors key to quickly check what's being highlighted would be sufficient?

@bensleveritt behavior similar to SublimeLinter's should be possible through our extension API. We already have a list of Errors/Warnings on the left of the status bar, so it would just be a matter of contributing a message in the status bar for the nearest error/warning on the current line.

@bgashler1 extension API does not provide way to retrieve Diagnostic instances. CodeActionContext has diagnostics property, but using CodeActionProvider for this will be quite hacky.

@bpasero could we address the API concern @ypresto mentioned?

Not sure I am the right one to answer, maybe ping @jrieken and/or @aeschli

No, there is currently no API to read all markers

Is anyone interested in writing an extension for this?

If so please open another issue titled something like "API Request: read all diagnostic markers" and reference this issue.

I am interested in something like this, however slightly different. I might be interested in writing the plugin for it, depending on some initial investigation. What i've been trying to do (which may exist, but I haven't found a way, as of yet), is hit a hotkey to have all the context info popup for the current cursor position. I don't want it in the hotbar, I want to hit "ctrl+m" or whatever, and the same info that shows up when you hover over the cursor position would appear.

Right now, the F8 key is a different popup and takes focus, which is jarring and sometimes forces me to hit F8 several times to cycle through the multiple errors on a line to find the one i'm interested in.

Included is the popup which shows when you mouse-over which would be awesome to have a hotkey for. Note in this context the mouse is hovering over "merged".

popup

Thoughts?

@morganhein I'm new to VSCode, and ended up here by looking for exactly what you've outlined.

I think it an obvious UX flaw not to have a hotkey for getting the info which can be quite relevant for the editing process, as in the default "edit mode" (on a non-mousey keyboard, eg. without touchpad nearby), your hands don't have easy access for adjusting cursor position, and reaching for the mouse is a bothersome shift of mode. (And F8 is very much a different feature.)

Did you find a way to assign a hotkey to invoke the popup?

F8 is another action: navigate in problems. It breaks the coding flow
I would really like as said a keyshortcut to display the message the same way mouse hover does.

This is important for me too, I usually navigate with the keyboard and I want to see errors that exist where my cursor is located and solve them quickly.
If I were to fix one error, but another one occurs at the cursor it is a much slower workflow to have to invoke a shortcut or reach for the mouse each time, not to mention the F8 shortcut starts at the first error and you have to step through them all to get where your cursor is.

Im also quite interested in this! Has there been a solution as of yet?

also interested as I came across this while using the vscode vim plugin and wondered how I could see the error with just a keyboard and F8 is brutal on the eyes compared to the mouse hover

I realized that there is a "showHover" setting that you can set that shows the hovering. The vscode vim plugin has "g + h" for this which you can set for yourself if needed. Only problem is exiting the tooltip where I currrently use "workbench.action.focusActiveEditorGroup" + "extension.vim_ctrl+[" to achieve

I come from Webstorm and I have also used Atom and I love the way that both of them give me instant feedback if I have errors. I am going to work on an extension that does this so if anyone wants to help, that would be greatly appreciated. I have never created an extension before so it may take me some time.

If you want to help, or have input, please let me know!

@dericcain Any updates on the extension? I would have time to help out..

@ognjenkurtic After doing some research, I found out that there is not an API extended to get this information. We will have to wait until it is made available to us.

FWIW, this is how Sublime Text shows error output, it's super-handy and I've been missing this feature since switching to VSCode.

Piling on. This is one of the few places where I miss Atom. Basically it was more obvious when I had a linter ERROR because the line number had a big red ball next to it. A quick pass through the file showed me if I was error free. The red squiggly line in VS Code is just a little too tough for my eyes to catch on a quick pass.

F8 isn't a great substitute for me because I (sometimes) will tolerate warnings. Another possible approach to "making it easy to find linter errors but not warnings" would be to be able to configure F8 or another key to do just show errors.

Tried using

vscode.commands.executeCommand(
                'vscode.executeHoverProvider', 
                vscode.window.activeTextEditor.document.uri,
                vscode.window.activeTextEditor.selection.active)

in the extension and almost got it. It returns correct information from the hover dialog if you try it on methods but returns 'any' if you try it on problems. Guess we 'll just have to wait.

I didn't see Show Hover: Ctrl+K, Ctrl+I mentioned here yet. That's what I came to look for here but accidentally found it in VS Code command palette and it does exactly what I want.

The Show Hover command is an acceptable workaround but I really wish I could just have it show up when my cursor moves over something (probably after a configurable delay).

Just for curiosity, is cursor mentioned here referring to a mouse cursor, or a keyboard cursor?

@hshin23, definitely keyboard cursor 馃榾 mouse already works fine. I have this issue as i only try to use the keyboard while editing code.

@scycer Thank god. I feel the same way. Having to go to trackpad or mouse just to see the error tool tip is just way too effortful. The should be an option to enable this.

Any ideas how to bind this to a VSCodeVim shortcut? I'd like to do <Leader>i.

I use it with vim.useCtrlKeys enabled show the default keyboard binding won't work.

Visual studio code is faster like atom but cant debug easy mvc webs html and mac when i am writing code i am relay enjoy
code my last code editor was visual studio community 2017 but now visual studio code have began my main code editor

We're pruning the list of open issues at the moment. Since there are workarounds (e.g., the show hover command) and since we already have F8 to navigate between problems in the editor and we also have the problems view, I'm going to close this issue.

Adding a message about the current context to the status bar is a good idea but definitely something that I think would be best exposed by an extension (assuming there are APIs available for this). If there are strong feelings about this, and the APIs are not available, I would recommend starting up a new issue to request the APIs so that this feature could be supported by an extension.

The reason I think it would be best exposed by an extension is because of the existing UI we have that displays this information already and the fact that the status bar already has a reasonable amount of information displayed in it. Allowing somebody to customise what they see in the status bar by adding an extension seems like the best approach for this.

Thanks for the suggestion.

Was this page helpful?
0 / 5 - 0 ratings