[ty] Always refresh diagnostics after a watched files change (#19697)

This commit is contained in:
Micha Reiser 2025-08-04 12:19:18 +02:00 committed by GitHub
parent 808c94d509
commit 8289432252
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -83,33 +83,27 @@ impl SyncNotificationHandler for DidChangeWatchedFiles {
return Ok(());
}
let mut project_changed = false;
for (root, changes) in events_by_db {
tracing::debug!("Applying changes to `{root}`");
let result = session.apply_changes(&AnySystemPath::System(root.clone()), changes);
session.apply_changes(&AnySystemPath::System(root.clone()), changes);
publish_settings_diagnostics(session, client, root);
project_changed |= result.project_changed();
}
let client_capabilities = session.client_capabilities();
if project_changed {
if client_capabilities.supports_workspace_diagnostic_refresh() {
client.send_request::<types::request::WorkspaceDiagnosticRefresh>(
session,
(),
|_, ()| {},
);
} else {
for key in session.text_document_keys() {
publish_diagnostics(session, &key, client);
}
if client_capabilities.supports_workspace_diagnostic_refresh() {
client.send_request::<types::request::WorkspaceDiagnosticRefresh>(
session,
(),
|_, ()| {},
);
} else {
for key in session.text_document_keys() {
publish_diagnostics(session, &key, client);
}
// TODO: always publish diagnostics for notebook files (since they don't use pull diagnostics)
}
// TODO: always publish diagnostics for notebook files (since they don't use pull diagnostics)
if client_capabilities.supports_inlay_hint_refresh() {
client.send_request::<types::request::InlayHintRefreshRequest>(session, (), |_, ()| {});