diff options
Diffstat (limited to 'helix-lsp/src/lib.rs')
-rw-r--r-- | helix-lsp/src/lib.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs index 95c61086..90f0c3fd 100644 --- a/helix-lsp/src/lib.rs +++ b/helix-lsp/src/lib.rs @@ -1,4 +1,5 @@ mod client; +pub mod file_event; pub mod jsonrpc; pub mod snippet; mod transport; @@ -547,6 +548,7 @@ pub enum MethodCall { WorkspaceFolders, WorkspaceConfiguration(lsp::ConfigurationParams), RegisterCapability(lsp::RegistrationParams), + UnregisterCapability(lsp::UnregistrationParams), } impl MethodCall { @@ -570,6 +572,10 @@ impl MethodCall { let params: lsp::RegistrationParams = params.parse()?; Self::RegisterCapability(params) } + lsp::request::UnregisterCapability::METHOD => { + let params: lsp::UnregistrationParams = params.parse()?; + Self::UnregisterCapability(params) + } _ => { return Err(Error::Unhandled); } @@ -629,6 +635,7 @@ pub struct Registry { syn_loader: Arc<helix_core::syntax::Loader>, counter: usize, pub incoming: SelectAll<UnboundedReceiverStream<(usize, Call)>>, + pub file_event_handler: file_event::Handler, } impl Registry { @@ -638,6 +645,7 @@ impl Registry { syn_loader, counter: 0, incoming: SelectAll::new(), + file_event_handler: file_event::Handler::new(), } } @@ -650,6 +658,7 @@ impl Registry { } pub fn remove_by_id(&mut self, id: usize) { + self.file_event_handler.remove_client(id); self.inner.retain(|_, language_servers| { language_servers.retain(|ls| id != ls.id()); !language_servers.is_empty() @@ -715,6 +724,7 @@ impl Registry { .unwrap(); for old_client in old_clients { + self.file_event_handler.remove_client(old_client.id()); tokio::spawn(async move { let _ = old_client.force_shutdown().await; }); @@ -731,6 +741,7 @@ impl Registry { pub fn stop(&mut self, name: &str) { if let Some(clients) = self.inner.remove(name) { for client in clients { + self.file_event_handler.remove_client(client.id()); tokio::spawn(async move { let _ = client.force_shutdown().await; }); |