Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork939
Fix #4501: Auto adjust stale diagnostic ranges on document changes#4513
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This map keeps track of overlays guarding the diagnostic ranges
It is also compatible with the experimental support for code snippets inside org-mode documents, see |
Can you resolve conflicts? Thank you! |
done |
msrd0 commentedFeb 17, 2025
I tried this PR and when I add/remove a line (regardless of whether that line is in front of or behind the diagnostic) the diagnostics move for a split second but then completely disappear. I've checked |
Hi@msrd0 |
msrd0 commentedFeb 26, 2025
@necto my emacs config is here:https://gitlab.com/msrd0/dotfiles/-/blob/master/HOME/.emacs.d/init.el?ref_type=heads#L63 Here's a video of the problem: 2025_02_26_1517.webmAs you can see, after I made sure there's an error in the file, everytime I save the error appears, and after I add a newline, the error disappears a short time after I made that edit, and only reappears when I save (emacs tells you at the bottom of the screen when it saves the file). |
To keep the diagnostic ranges actual after document edits and before LSP sends an update (can take multiple seconds or even minutes for SonarLint C++ analysis), allocate an overlay for each diagnostic and use it as the reference for its range.
This change works well together with#4512, which spares the LSP server from playing catch-up with the user modifications.
lsp-diagnosticsandlsp--get-buffer-diagnosticsnow have an additional optional argument:update-ranges?that refreshes the diagnostic ranges.Thisfixes#4501.