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