From 073000e54d862ef542387868c897d4f847fbe18a Mon Sep 17 00:00:00 2001 From: Philipp Mildenberger Date: Mon, 20 Mar 2023 18:04:02 +0100 Subject: [PATCH] Maintain language servers TOML array order in `doc.language_servers` --- helix-view/src/document.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index f2f373aac..bd3c465d4 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -1429,13 +1429,17 @@ pub fn version(&self) -> i32 { self.version } + /// maintains the order as configured in the language_servers TOML array pub fn language_servers(&self) -> impl Iterator { - self.language_servers.values().filter_map(|l| { - if l.is_initialized() { - Some(&**l) - } else { - None - } + self.language_config().into_iter().flat_map(move |config| { + config.language_servers.iter().filter_map(move |features| { + let ls = &**self.language_servers.get(&features.name)?; + if ls.is_initialized() { + Some(ls) + } else { + None + } + }) }) }