mirror of https://github.com/astral-sh/ruff
Merge f9a461a6db into b0bc990cbf
This commit is contained in:
commit
5c4d1c02a8
|
|
@ -1,4 +1,5 @@
|
||||||
use crate::{
|
use crate::{
|
||||||
|
Session,
|
||||||
lint::DiagnosticsMap,
|
lint::DiagnosticsMap,
|
||||||
session::{Client, DocumentQuery, DocumentSnapshot},
|
session::{Client, DocumentQuery, DocumentSnapshot},
|
||||||
};
|
};
|
||||||
|
|
@ -38,9 +39,13 @@ pub(super) fn publish_diagnostics_for_document(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn clear_diagnostics_for_document(
|
pub(super) fn clear_diagnostics_for_document(
|
||||||
|
session: &Session,
|
||||||
query: &DocumentQuery,
|
query: &DocumentQuery,
|
||||||
client: &Client,
|
client: &Client,
|
||||||
) -> crate::server::Result<()> {
|
) -> crate::server::Result<()> {
|
||||||
|
if session.resolved_client_capabilities().pull_diagnostics {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
client
|
client
|
||||||
.send_notification::<lsp_types::notification::PublishDiagnostics>(
|
.send_notification::<lsp_types::notification::PublishDiagnostics>(
|
||||||
lsp_types::PublishDiagnosticsParams {
|
lsp_types::PublishDiagnosticsParams {
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ impl super::SyncNotificationHandler for DidClose {
|
||||||
);
|
);
|
||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
clear_diagnostics_for_document(snapshot.query(), client)?;
|
clear_diagnostics_for_document(session, snapshot.query(), client)?;
|
||||||
|
|
||||||
session
|
session
|
||||||
.close_document(&key)
|
.close_document(&key)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue