Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1287e86

Browse files
committed
Clear diagnostics only after new ones were received
1 parent5706217 commit1287e86

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

‎src/tools/rust-analyzer/crates/rust-analyzer/src/global_state.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ pub(crate) struct GlobalState {
8787
pub(crate)flycheck_sender:Sender<flycheck::Message>,
8888
pub(crate)flycheck_receiver:Receiver<flycheck::Message>,
8989
pub(crate)last_flycheck_error:Option<String>,
90+
pub(crate)diagnostics_received:bool,
9091

9192
// Test explorer
9293
pub(crate)test_run_session:Option<Vec<flycheck::CargoTestHandle>>,
@@ -224,6 +225,7 @@ impl GlobalState {
224225
flycheck_sender,
225226
flycheck_receiver,
226227
last_flycheck_error:None,
228+
diagnostics_received:false,
227229

228230
test_run_session:None,
229231
test_run_sender,

‎src/tools/rust-analyzer/crates/rust-analyzer/src/main_loop.rs‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,10 @@ impl GlobalState {
804804
fnhandle_flycheck_msg(&mutself,message: flycheck::Message){
805805
match message{
806806
flycheck::Message::AddDiagnostic{ id, workspace_root, diagnostic} =>{
807+
if !self.diagnostics_received{
808+
self.diagnostics.clear_check(id);
809+
self.diagnostics_received =true;
810+
}
807811
let snap =self.snapshot();
808812
let diagnostics =crate::diagnostics::to_proto::map_rust_diagnostic_to_lsp(
809813
&self.config.diagnostics_map(),
@@ -832,7 +836,7 @@ impl GlobalState {
832836
flycheck::Message::Progress{ id, progress} =>{
833837
let(state, message) =match progress{
834838
flycheck::Progress::DidStart =>{
835-
self.diagnostics.clear_check(id);
839+
self.diagnostics_received =false;
836840
(Progress::Begin,None)
837841
}
838842
flycheck::Progress::DidCheckCrate(target) =>(Progress::Report,Some(target)),
@@ -848,6 +852,9 @@ impl GlobalState {
848852
flycheck::Progress::DidFinish(result) =>{
849853
self.last_flycheck_error =
850854
result.err().map(|err|format!("cargo check failed to start: {err}"));
855+
if !self.diagnostics_received{
856+
self.diagnostics.clear_check(id);
857+
}
851858
(Progress::End,None)
852859
}
853860
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp