@@ -788,6 +788,8 @@ impl Document {
788 diagnostic.range.end = changes.map_pos(diagnostic.range.end, Assoc::After);
788 diagnostic.range.end = changes.map_pos(diagnostic.range.end, Assoc::After);
789 diagnostic.line = self.text.char_to_line(diagnostic.range.start);
789 diagnostic.line = self.text.char_to_line(diagnostic.range.start);
792+ .sort_unstable_by_key(|diagnostic| diagnostic.range);
792 // emit lsp notification
794 // emit lsp notification
793 if let Some(language_server) = self.language_server() {
795 if let Some(language_server) = self.language_server() {