Skip to content
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

Finer-grained control of diagnostic display by level #3265

Closed
smackesey opened this issue Aug 3, 2021 · 1 comment
Closed

Finer-grained control of diagnostic display by level #3265

smackesey opened this issue Aug 3, 2021 · 1 comment
Labels
enhancement New feature or request

Comments

@smackesey
Copy link
Contributor

smackesey commented Aug 3, 2021

Is your feature request related to a problem? Please describe.

At present, CoC provides a few settings governing how diagnostics are displayed. Some relevant ones are:

  • diagnostic.enableHighlightLineNumber
  • diagnostic.enableSign
  • diagnostic.level

enableSign and enableHighlightLineNumber are boolean settings-- they are either on or off for all diagnostics that aren't totally ignored. This is problematic because some language server diagnostics at the hint and information level aren't designed to indicate a problem but merely provide additional information about the code. For example, PyRight notifies the client of unused function parameters with a hint diagnostic. This is intended to be subtle, and by default in VSCode dulls the highlighting of a symbol. CoC, however, makes you style these "annotations" similarly to real errors. Here are two issues discussing this situation with developers of PyRight and coc-pyright:

Describe the solution you'd like

This scenario can be solved by allowing a finer level of control over diagnostic styling. Specifically:

  • Make all boolean styling options configurable on a level basis. For example, diagnostic.enableHighlightLineNumber could take a value of {hint,information,warning,error}, and the highlight would only be shown for diagnostics >= the configured level.

Similarly, it would be nice if it were possible to filter annotative diagnostics out of the diagnostic list, so that users could still benefit from the hints provided by a language server while keeping a separate list of errors/warnings that need to be addressed. This could be done with two adjustments:

  • allow CocList diagnostics to take a level argument of {error,warning,information,hint}
  • provide a setting like diagnostics.jumpListLevel (this is probably not the best name) that also takes a level argument of {error,warning,information,hint} and that controls the behavior of <Plug>(coc-diagnostic-next) and <Plug>(coc-diagnostic-prev), i.e. that causes these commands to skip lower-level diagonistics.
@fannheyward
Copy link
Member

I think the main problem is: how do we treat about the Hint diagnostic.

coc will display diagnostics with different sign highlight group, will gray out Hint diagnostics that with Unused tag, will preview the diagnostic message in floating window when your cursor on them, they're diagnostics with different severities, different UI.

VSCode won't display the Hint diagnostics, won't list them in Problems, but if you put your cursor on them, VSCode displayed the diagnostic message.

The LSP defines a diagnostic with Error/Warning/Information/Hint level, the client displays/lists the diagnostics in different ways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants