-
Notifications
You must be signed in to change notification settings - Fork 184
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
Feature request: Toggle showing of diagnostics #2161
Comments
But diagnostics typically come up on typing so I'm not sure why is there an implication here that this is a "on save"-only problem. In any case, your suggested solution sounds very corner-case and manual and not that universally useful to be honest. I think you could look at suggestion in #2117 which might also solve your use case if implemented. |
I think you could achieve this with a plugin in your User/ folder that could, for example, toggle the |
Though that would result in restarting the server which can be slow for Rust. |
I only started using LSP today. So this sounds like the problem is actually worse than I thought? D: I assumed diagnostics were shown on save because of the
I don't think 2117 exactly solves the problem because I might write half a function and then stare at it for a minute or leave the computer to go get a glass of water or something. It seems like "Don't show me stuff until I'm ready to look at it" is not that unreasonable a request, and saving the file is a good way of signaling I'm ready to look at it (except for my tendency to save when I shouldn't). |
I second this. Was just going to open an issue asking if this was possible I use LSP-pyright, and while im coding there are alot of false positives or just simply alot of real errors. I wrote a command to toggle It would be really helpful to be able to disable highlighting without restarting the server to make reading the code easier, then quickly toggling it back on to handle the errors. |
As mentioned in sublimelsp/LSP-ruff#67, in VSCode ecosystem the extensions sometimes provide option like `lint: onSave | onType'. For servers that support pull model for diagnostics, the client could decide when to update the diagnostics so in that cases we would at least be able to do something. (though initial post mentions hammering "save" at random times so it would probably not help that case ;)) |
For the diagnostics pull model it doesn't seem that difficult to implement an option for requesting diagnostics only on save, instead of after each change. We would just need to add a check of such a user setting before doing the request at Lines 347 to 352 in f983345
and then also add similar code either in the DocumentSyncListener.on_post_save_async or directly in the LspSaveCommand .
However, this would also mean that diagnostics are not automatically cleared anymore when you just fixed an error in the code (except for if you select and remove the entire line/block). Not sure whether this behavior would be better than the current situation, or how it is handled in other editors. But I guess an option can't hurt, so that users could choose their preferred behavior. By the way, I have a PR open at #2448 which would not restart servers anymore when the |
I was just searching issues to see if someone had suggested this before - more control over when diagnostics are shown would be very valuable to me, too. The option to show new diagnostics only after a timer would help a bit, only on save would be a significant improvement. (And at least to me, it would be nice but it's not really important that diagnostics are immediately cleared vs. only cleared on saving again.) A reasonable way to toggle diagnostics and show them only when I'm ready to deal with them would also be a big help to me, ideally with the ability to bind this to a hotkey. It is extremely distracting to me to have error or warning indicators and underlines showing up in code while I am actively typing it. The diagnostics are very helpful in catching errors, but I do not want to see them appearing and disappearing while I am still in the middle of typing something. |
Is your feature request related to a problem? Please describe.
I have a tendency to hit ctrl-S to save very frequently and without thinking about it. Sometimes this results in LSP coming up before its help is particularly helpful. Sometimes, the annotations it provides are obtrusive:
If I was looking for a bug, this outline would be quite helpful, so I don't want to turn off these annotations. But sometimes I don't need it yet. If I am still working on the function it is just distracting.
Describe the solution you'd like
I would like a Sublime Text "command" I could map to a key shortcut, which temporarily dismisses everything LSP, as if I had not yet saved. Remove all annotations, and hide the diagnostics panel. However I don't want this dismissal to be modal, IE, I don't want to have to turn it back on again. I just want it to remove itself until I next hit save and it brings itself back up again.
Describe alternatives you've considered
LSP was initially my alternative :) I used to use rust-enhanced which has even more obtrusive annotations.
The ESC key already hides the bottom pane; there could be an option for it to hide annotations as well.
I guess one additional possible alternative would be a keystroke to hide LSP annotations altogether, a feature I think already exists. But if I did this I am afraid (ok, I am certain) I would forget to turn them back on again and then they would not be there when I needed them.
Notes
I think this should also hide "Inlay Hints" once that feature is added(?).
The text was updated successfully, but these errors were encountered: