@@ -721,7 +721,7 @@ impl Application {
724− Notification::PublishDiagnostics(mut params) => {
724+ Notification::PublishDiagnostics(params) => {
725 let path = match params.uri.to_file_path() {
725 let path = match params.uri.to_file_path() {
726 Ok(path) => path,
726 Ok(path) => path,
727 Err(_) => {
727 Err(_) => {
@@ -841,15 +841,10 @@ impl Application {
841 doc.replace_diagnostics(diagnostics, server_id);
841 doc.replace_diagnostics(diagnostics, server_id);
844− // Sort diagnostics first by severity and then by line numbers.
845− // Note: The `lsp::DiagnosticSeverity` enum is already defined in decreasing order
848− .sort_unstable_by_key(|d| (d.severity, d.range.start));
849− let diagnostics = params
844+ let mut diagnostics = params
850 .diagnostics
845 .diagnostics
851 .into_iter()
846 .into_iter()
852− .map(|d| (d, server_id, offset_encoding))
847+ .map(|d| (d, server_id))
853 .collect();
848 .collect();
855 // Insert the original lsp::Diagnostics here because we may have no open document
850 // Insert the original lsp::Diagnostics here because we may have no open document
@@ -859,10 +854,16 @@ impl Application {
859 Entry::Occupied(o) => {
854 Entry::Occupied(o) => {
860 let current_diagnostics = o.into_mut();
855 let current_diagnostics = o.into_mut();
861 // there may entries of other language servers, which is why we can't overwrite the whole entry
856 // there may entries of other language servers, which is why we can't overwrite the whole entry
862− current_diagnostics.retain(|(_, lsp_id, _)| *lsp_id != server_id);
857+ current_diagnostics.retain(|(_, lsp_id)| *lsp_id != server_id);
863− current_diagnostics.extend(diagnostics);
858+ current_diagnostics.append(&mut diagnostics);
859+ // Sort diagnostics first by severity and then by line numbers.
860+ // Note: The `lsp::DiagnosticSeverity` enum is already defined in decreasing order
862+ .sort_unstable_by_key(|(d, _)| (d.severity, d.range.start));
865 Entry::Vacant(v) => {
864 Entry::Vacant(v) => {
866+ .sort_unstable_by_key(|(d, _)| (d.severity, d.range.start));
866 v.insert(diagnostics);
867 v.insert(diagnostics);