diff options
author | Philipp Mildenberger | 2023-04-05 16:50:05 +0000 |
---|---|---|
committer | Philipp Mildenberger | 2023-05-18 20:04:47 +0000 |
commit | 39b9a4bba2a026844348886c9d9f2026a3d6f658 (patch) | |
tree | 5d940e2692d13faf949606aa5bb13267dad48547 /helix-view/src | |
parent | 521cdec5a1a53c61d38ce5a1df85f82857f59149 (diff) |
Add function `Editor::language_server_by_id` and refactor/simplify related code, also don't 'crash' in completion menu if language_server somehow disappeared
Diffstat (limited to 'helix-view/src')
-rw-r--r-- | helix-view/src/editor.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index ca2144fd..afb8d91f 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -874,7 +874,7 @@ pub struct Editor { /// times during rendering and should not be set by other functions. pub cursor_cache: Cell<Option<Option<Position>>>, /// When a new completion request is sent to the server old - /// unifinished request must be dropped. Each completion + /// unfinished request must be dropped. Each completion /// request is associated with a channel that cancels /// when the channel is dropped. That channel is stored /// here. When a new completion request is sent this @@ -1093,6 +1093,11 @@ impl Editor { self._refresh(); } + #[inline] + pub fn language_server_by_id(&self, language_server_id: usize) -> Option<&helix_lsp::Client> { + self.language_servers.get_by_id(language_server_id) + } + /// Refreshes the language server for a given document pub fn refresh_language_servers(&mut self, doc_id: DocumentId) -> Option<()> { self.launch_language_servers(doc_id) |