Allow to temporarily stop LSP servers (#28034)

Same as `editor::RestartLanguageServer`, now there's an
`editor::StopLanguageServer` action that stops all language servers,
related to the currently opened editor.

Opening another singleton editor with the same language or changing
selections in a multi buffer will bring the servers back up.

Release Notes:

- Added a way to temporarily stop LSP servers

---------

Co-authored-by: Michael Sloan <mgsloan@gmail.com>
This commit is contained in:
Kirill Bulatov 2025-04-03 12:50:43 -06:00 committed by GitHub
parent b9724d9cbe
commit 0c82541f0a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 114 additions and 28 deletions

View file

@ -3015,6 +3015,16 @@ impl Project {
})
}
pub fn stop_language_servers_for_buffers(
&mut self,
buffers: Vec<Entity<Buffer>>,
cx: &mut Context<Self>,
) {
self.lsp_store.update(cx, |lsp_store, cx| {
lsp_store.stop_language_servers_for_buffers(buffers, cx)
})
}
pub fn cancel_language_server_work_for_buffers(
&mut self,
buffers: impl IntoIterator<Item = Entity<Buffer>>,