From 58c913ce4567a95c52808d78245eb1dac806971c Mon Sep 17 00:00:00 2001 From: Philipp Mildenberger Date: Sun, 19 Mar 2023 19:26:39 +0100 Subject: Simplify 'lsp_stop' command --- helix-view/src/document.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'helix-view/src/document.rs') diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 3fd271eb..49eb13a0 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -1442,6 +1442,13 @@ impl Document { .filter_map(|l| if l.is_initialized() { Some(&**l) } else { None }) } + pub fn remove_language_server_by_name(&mut self, name: &str) -> Option> { + match self.language_servers.iter().position(|l| l.name() == name) { + Some(index) => Some(self.language_servers.remove(index)), + None => None, + } + } + // TODO filter also based on LSP capabilities? pub fn language_servers_with_feature( &self, -- cgit v1.2.3-70-g09d2