feat: toggle show diagnostics without server restart #2429
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
referencing #2161 (comment)
Introduce the ability to toggle the display of diagnostics without restarting the server
LSP-pyright's output can be quite distracting when trying to read the code to understand it before making changes.
Current method to hide the output, setting
show_diagnostics_severity_level
to0
, causes the server to restart which can take quite a while with lsp-pyright. Which can be very frustrating and slows down development.Even worse is that there is no indication that the server is still starting up, so i have to wait longer to make sure there are no errors as opposed to the server still starting up
How it works is by caching the latest diagnostic information. When toggled off, it removes the regions, and when toggled on again, it re-adds the regions by mimicking that new diagnostic information was received
This PR is more a low-quality proof of concept as I don't know the LSP code-base enough nor whats required to contribute correctly