Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

project: Reorder LSP Adapters within LanguageRegistry (#23528)

Piotr Osiewicz828b5ab9758e
diff --git a/crates/project/src/project_tree/server_tree.rs b/crates/project/src/project_tree/server_tree.rs
index eb6496db323..c222b68a2bf 100644
--- a/crates/project/src/project_tree/server_tree.rs
+++ b/crates/project/src/project_tree/server_tree.rs
@@ -286,6 +286,20 @@ impl LanguageServerTree {
))
})
.collect::<IndexMap<_, _>>();
+ // After starting all the language servers, reorder them to reflect the desired order
+ // based on the settings.
+ //
+ // This is done, in part, to ensure that language servers loaded at different points
+ // (e.g., native vs extension) still end up in the right order at the end, rather than
+ // it being based on which language server happened to be loaded in first.
+ self.languages.reorder_language_servers(
+ &language_name,
+ adapters_with_settings
+ .keys()
+ .map(|wrapper| wrapper.0.clone())
+ .collect(),
+ );
+
adapters_with_settings
}