From 7c9809eeb2708a9eba3c3cc48c9513e9892409f0 Mon Sep 17 00:00:00 2001 From: ath3 Date: Mon, 3 Oct 2022 17:02:49 +0200 Subject: Find workspace from document path (#3553) --- helix-lsp/src/lib.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'helix-lsp/src/lib.rs') diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index 98300a62..feeedc96 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -353,6 +353,7 @@ impl Registry { pub fn restart( &mut self, language_config: &LanguageConfiguration, + doc_path: Option<&std::path::PathBuf>, ) -> Result>> { let config = match &language_config.language_server { Some(config) => config, @@ -367,7 +368,8 @@ impl Registry { // initialize a new client let id = self.counter.fetch_add(1, Ordering::Relaxed); - let NewClientResult(client, incoming) = start_client(id, language_config, config)?; + let NewClientResult(client, incoming) = + start_client(id, language_config, config, doc_path)?; self.incoming.push(UnboundedReceiverStream::new(incoming)); let (_, old_client) = entry.insert((id, client.clone())); @@ -381,7 +383,11 @@ impl Registry { } } - pub fn get(&mut self, language_config: &LanguageConfiguration) -> Result>> { + pub fn get( + &mut self, + language_config: &LanguageConfiguration, + doc_path: Option<&std::path::PathBuf>, + ) -> Result>> { let config = match &language_config.language_server { Some(config) => config, None => return Ok(None), @@ -393,7 +399,8 @@ impl Registry { // initialize a new client let id = self.counter.fetch_add(1, Ordering::Relaxed); - let NewClientResult(client, incoming) = start_client(id, language_config, config)?; + let NewClientResult(client, incoming) = + start_client(id, language_config, config, doc_path)?; self.incoming.push(UnboundedReceiverStream::new(incoming)); entry.insert((id, client.clone())); @@ -493,6 +500,7 @@ fn start_client( id: usize, config: &LanguageConfiguration, ls_config: &LanguageServerConfiguration, + doc_path: Option<&std::path::PathBuf>, ) -> Result { let (client, incoming, initialize_notify) = Client::start( &ls_config.command, @@ -501,6 +509,7 @@ fn start_client( &config.roots, id, ls_config.timeout, + doc_path, )?; let client = Arc::new(client); -- cgit v1.2.3-70-g09d2