vscode: Error hover semantic information should be rendered separate of error message

From @octref in #62159

This is a regression on the diagnostics display.

1.28:

image

Insiders:

image

In both case, the diagnostics returned are:

const diagnostics = {
  code: "unknownProperties",
  source: "css.lint.unknownProperties",
  message: "Unknown property: 'foo1'"
}

If we have access to semantic information we should render it much better. The message should come first. Then the source on a separate line, with a Source: label preceding it and in non-monospace font (since source should be a user-readable string like CSS Lint). Then, the code with the same style, but with monospace, since code is often a library/OS error code. Something like:

Unknown property: 'foo1'

Source: CSS Lint Code: unknownProperties

cc @sandy081 @ramya-rao-a @misolori

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 36 (33 by maintainers)

Commits related to this issue

Most upvoted comments

I vote for Option 3. Imho a user is not interested in the source and of course not the code. I would always render source and code in the problems panel such that users who are interested in this can go to the view that provides more details. Similar analogy is debug hover, gives you minimalistic information, if you want more please open the debug viewlet.

If we decide to go with option 2 I suggest to right align it so it is less noticable and less space between it and the actual error.

Another idea from (@glen-84) is to have everything in single line and left aligned. Some realtime examples:

screenshot 2018-11-23 at 15 35 36

image

image

Edit: Credits to @glen-84 šŸ˜ƒ

Another suggestion from @egamma is to inline the source and code with the message without labels

image

image

image

I think first we have to decide whether the metadata should be shown at all, or whether it should be configurable to be hidden, etc. Then, if itā€™s shown, how it should be displayed.

I think it should be shown because if I have multiple extensions contributing diagnostics, I want to know where a message is coming from. The error code is also useful, e.g. if you want to know which rule in a tslint.json is associated with an error message. I prefer option 1.

source and code displayed together in the left, the most prominent & easily-scannable place

While that is true, isnā€™t the real question what value the code attribute has at all? Usually this is a number and for css its seems to be a close variant of the message. Are people reading/understanding diagnostics like: ā€œOh error TS33165, I better not assign a boolean to a stringā€ or do they understand the message ā€œType boolean cannot be assigned to type stringā€ better/faster? For me the code is something I would use when googling a problem I donā€™t understand by reading the message and therefore the least important piece of information.

Fixes for his have caused regression for https://github.com/rust-lang/rls-vscode. We used backtick-enclosed strings for types and since everything is escaped now to render a custom hover window, the error messages are illegible now, for example:

current output

note: expected type std::option::Option<std::string::String> found type std::option::Option<&std::string::String>

previous output

note: expected type std::option::Option<std::string::String> found type std::option::Option<&std::string::String>

See https://github.com/rust-lang/rls-vscode/issues/479 for more details.

Another idea is to have everything in single line

I feel so ignored. šŸ˜„

There have been too many iterations done on this and thanks to all for the suggestions. Since it is highly individual opinionated, I would collect more feedback on the current approach before changing and going in circles.

Thereā€™s no consistency. Problems View:

  • Square bracket for source
  • Paren for range

Inline View:

  • Source has no bracket
  • Paren for code

I also donā€™t like the code/source appended to the last lineā€™s message. If not on a new line, I hope they can be right-aligned.

This is how it looks when I align it to right. Not sure right alignment looks good for all. May be it is better to go with left alignment?

image

This is what I meant:

image

Made Hover consistent with Inline and Problems view

image

This is the best can be done before introducing more UI changes. I would not invest more as the current approach is OKish and do not see complains from users.