@ -964,22 +964,18 @@ impl Application {
Notification ::Exit = > {
Notification ::Exit = > {
self . editor . set_status ( "Language server exited" ) ;
self . editor . set_status ( "Language server exited" ) ;
// Clear any diagnostics for documents with this server open.
// LSPs may produce diagnostics for files that haven't been opened in helix,
let urls : Vec < _ > = self
// we need to clear those and remove the entries from the list if this leads to
. editor
// an empty diagnostic list for said files
. documents_mut ( )
for diags in self . editor . diagnostics . values_mut ( ) {
. filter_map ( | doc | {
diags . retain ( | ( _ , lsp_id ) | * lsp_id ! = server_id ) ;
if doc . supports_language_server ( server_id ) {
}
doc . clear_diagnostics ( server_id ) ;
doc . url ( )
} else {
None
}
} )
. collect ( ) ;
for url in urls {
self . editor . diagnostics . retain ( | _ , diags | ! diags . is_empty ( ) ) ;
self . editor . diagnostics . remove ( & url ) ;
// Clear any diagnostics for documents with this server open.
for doc in self . editor . documents_mut ( ) {
doc . clear_diagnostics ( server_id ) ;
}
}
// Remove the language server from the registry.
// Remove the language server from the registry.