mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 11:20:54 +00:00
fix: Fix flycheck diagnostics flickering for binary targets
This commit is contained in:
parent
a77cf8e189
commit
cf307438bc
@ -345,6 +345,7 @@ impl FlycheckActor {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if self.package_status.is_empty() {
|
if self.package_status.is_empty() {
|
||||||
|
tracing::trace!(flycheck_id = self.id, "clearing diagnostics");
|
||||||
// We finished without receiving any diagnostics.
|
// We finished without receiving any diagnostics.
|
||||||
// That means all of them are stale.
|
// That means all of them are stale.
|
||||||
self.send(FlycheckMessage::ClearDiagnostics {
|
self.send(FlycheckMessage::ClearDiagnostics {
|
||||||
@ -354,6 +355,11 @@ impl FlycheckActor {
|
|||||||
} else {
|
} else {
|
||||||
for (package_id, status) in mem::take(&mut self.package_status) {
|
for (package_id, status) in mem::take(&mut self.package_status) {
|
||||||
if let DiagnosticReceived::No = status {
|
if let DiagnosticReceived::No = status {
|
||||||
|
tracing::trace!(
|
||||||
|
flycheck_id = self.id,
|
||||||
|
package_id = package_id.repr,
|
||||||
|
"clearing diagnostics"
|
||||||
|
);
|
||||||
self.send(FlycheckMessage::ClearDiagnostics {
|
self.send(FlycheckMessage::ClearDiagnostics {
|
||||||
id: self.id,
|
id: self.id,
|
||||||
package_id: Some(package_id),
|
package_id: Some(package_id),
|
||||||
@ -385,9 +391,15 @@ impl FlycheckActor {
|
|||||||
"diagnostic received"
|
"diagnostic received"
|
||||||
);
|
);
|
||||||
if let Some(package_id) = &package_id {
|
if let Some(package_id) = &package_id {
|
||||||
if !self.package_status.contains_key(package_id) {
|
if let None | Some(DiagnosticReceived::No) = self
|
||||||
self.package_status
|
.package_status
|
||||||
.insert(package_id.clone(), DiagnosticReceived::Yes);
|
.insert(package_id.clone(), DiagnosticReceived::Yes)
|
||||||
|
{
|
||||||
|
tracing::trace!(
|
||||||
|
flycheck_id = self.id,
|
||||||
|
package_id = package_id.repr,
|
||||||
|
"clearing diagnostics"
|
||||||
|
);
|
||||||
self.send(FlycheckMessage::ClearDiagnostics {
|
self.send(FlycheckMessage::ClearDiagnostics {
|
||||||
id: self.id,
|
id: self.id,
|
||||||
package_id: Some(package_id.clone()),
|
package_id: Some(package_id.clone()),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user