Closed tomjw64 closed 2 months ago
Was just about to file this. For me, this is only happening over SSH.
Looking at this, what I just noticed could cause this is if the next flycheck gets cancelled, the diagnostics are not cleared. But I don't think that should happen too often so probably not the issue?
I'll try to look if I can replicate it (maybe with ssh), but does it happen for you with all projects? Or just some specific ones?
I also encountered this issue. The problem started after upgrading to the latest version of rust-analyzer yesterday afternoon. I encountered this issue on both VSCode and Zed.
Was just about to file this. For me, this is only happening over SSH.
It might be because your local and remote environments are using different versions of the rust-analyzer extension. Once you upgrade them to the latest version, you will encounter the same issue.
I'm having the exact same issue on my local vscode. Errors don't seem to get cleared after fixing the code. (just to confirm, I downgraded to v0.3.1958 and all is well)
Right, I can tell the issue. If you have check on save diagnostics somewhere and the next check succeeds without emitting any again we won't clear them as the logic only does when a diagnostic was received :facepalm:
Right, it's in fact the other way around, we don't clear it if a succeeding check still has diagnostics (that is we accumulate), which is what one can observein the linked example video (the test
function is unused and hence always emits a warning)
If a check has diagnostics, the old ones should be cleared when the first AddDiagnostic
is received so in that example when the unused function diagnostics is received, all other should disappear.
The state is tracked for flychecks globally though, so if there are invocations per workspace, that would be broken as the first finishing flycheck would clear its (potentially empty) diagnostics and the other flychecks would accumulate.
I also encountered this issue. The problem started after upgrading to the latest version of rust-analyzer yesterday afternoon. I encountered this issue on both VSCode and Zed.
temporary fix for zed:
set rust-analyzer binary in your settings.json to the rustup rust-analzyer as follow:
"lsp": { "rust-analyzer": { "binary": { "path": "/Users/[ur_user_name]/.cargo/bin/rust-analyzer", "arguments": [] } } }
then switch your rustup to a stable version (e.g. 1.78.0) and restart zed editor
set rust-analyzer binary in your settings.json to the rustup rust-analzyer
Note that rust-analyzer is not installed by rustup when you use the default profile, you need to add the component manually if you haven't yet.
This seems to be a regression from the last released version of the rust-analyzer extension. When the file is saved, diagnostics will appear, but then if problem is fixed and saved again, the diagnostics will remain. The extension must be restarted to clear diagnostics.
This only occurs on the newest version of rust-analyzer. When testing on 0.3.1958, this issue does not occur. I suspect it has something to do with this PR.
rust-analyzer version: 2024-05-27
rustc version: rustc 1.80.0-nightly (bdbbb6c6a 2024-05-26)
editor or extension: VSCode, extension version 0.3.1975
example video of issue: https://github.com/rust-lang/rust-analyzer/assets/1285308/9dee3798-cddd-4e76-9a11-e49cfd510cca