fix: correctly reset inlay hints when stopping or restarting LSPs for a document (#10741)

This commit is contained in:
Poliorcetics 2024-06-02 17:39:48 +02:00 committed by GitHub
parent 179673568d
commit 972265640d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 0 deletions

View file

@ -1495,6 +1495,8 @@ fn lsp_stop(
for doc in cx.editor.documents_mut() { for doc in cx.editor.documents_mut() {
if let Some(client) = doc.remove_language_server_by_name(ls_name) { if let Some(client) = doc.remove_language_server_by_name(ls_name) {
doc.clear_diagnostics(Some(client.id())); doc.clear_diagnostics(Some(client.id()));
doc.reset_all_inlay_hints();
doc.inlay_hints_oudated = true;
} }
} }
} }

View file

@ -1356,6 +1356,7 @@ impl Editor {
let doc = doc_mut!(self, &doc_id); let doc = doc_mut!(self, &doc_id);
let diagnostics = Editor::doc_diagnostics(&self.language_servers, &self.diagnostics, doc); let diagnostics = Editor::doc_diagnostics(&self.language_servers, &self.diagnostics, doc);
doc.replace_diagnostics(diagnostics, &[], None); doc.replace_diagnostics(diagnostics, &[], None);
doc.reset_all_inlay_hints();
} }
/// Launch a language server for a given document /// Launch a language server for a given document