vscode: Display diagnostic error codes

Would it be possible for the diagnostic error code to be surfaced to the user in some way?

Diagnostics as defined in the LSP and vscode-api have a code field which is not easily visible to the user in vscode. Language servers/compilers often allow the suppression of specific diagnostics by passing a list of error codes to ignore. Currently, as far as I know, extensions have to intercept LSP diagnostics and hardbake the code into error message, or incorrectly use the source field.

E.g: image image Both of these solutions are less than ideal, as they mean that the raw “Copy” data is incorrect, and inconsistent across extensions.

It seems odd that source, a field that is generally obvious from context, is displayed, but there is no proper support for the code field.

I’m not sure what the best way of actually displaying it would be, but a few things come to mind:

  1. Add it to the hover (as suggested by @egamma in #44017 )
  2. Display it together with the source
  3. Display it instead of the source, and move the source to the end of the row

About this issue

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

Commits related to this issue

Most upvoted comments

Please bring back the name in the hover. If I need to disable a rule that’s where I get the name from.

Now I’m stuck googling the error message or linting the whole project from the command line to get the name 🤦‍♂️

Before line numbers

image

@tboby

image

Starting from vscode-eslint@1.6.1, the easiest way to get eslint’s rule id is to open the Problems window.

image

cc @cdeutsch @drKnoxy