New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display diagnostic error codes #49215
Comments
(Experimental duplicate detection) |
Neither of these issues are duplicate, although the second isn't far off, nice try! |
Yes, fair request. For the sake of completeness there is the hover, the f8-feature, and the error list.
The motivation for that is the presence of different validators, e.g. TypeScript for syntax/semantic checks and TSLint for linting. Adding @sandy081 for the errors list and for more feedback |
I think the current format
|
How about showing it at the end. The message is the most important part of a diagnostic and it would be good when it comes first.
|
I'm also guilty of (mis)using the source field for error codes. While I also agree that the message is the most important part, I would also say that the code is equal to or greater in importance than the source because it is useful for things like error suppression comments or looking up documentation (such as googling "c# error 1234"), while the source is only useful if someone has multiple extensions with non-obvious diagnostics. Therefore option 3 would seem to be the best fit, but option 2 would also be acceptable if it's too much of a change. |
The C/C++ extension is adding error/warning codes so that users can disable particular errors/warnings like VS 2017 has so we'd highly like VS Code to add this. In the mean time, how do you recommend we expose the error codes to users? Our current plan is to add it to the end of the message until this is fixed. We're also adding "C/C++" as the source and many users have requested filtering based on that (I think there's another issue tracking that). |
How about showing error code at the end as @egamma mentioned |
Maybe not at the end-end but before the line/column info? |
Before line numbers |
@egamma I see diagnostic code is being repeated in message part for TS Lint diagnostics. Is it possible to remove them from the message? |
@sandy081 I´ve removed rendering of the |
@dbaeumer pls check whether you have the same issue of duplicate error code in eslint. |
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 🤦♂️ |
Yes |
Removed it from ESLint and published new version for |
Hey i'm the maintainer of eslint-disable, any tips on how to get at the rule id so that we can disable rules again? |
@drKnoxy you might want to have a look at microsoft/vscode-eslint#530 which adds the as quick fixes to the extension directly. |
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 thesource
field.E.g:
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 thecode
field.I'm not sure what the best way of actually displaying it would be, but a few things come to mind:
The text was updated successfully, but these errors were encountered: