Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-view/src/editor.rs')
| -rw-r--r-- | helix-view/src/editor.rs | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index d7058d3e..2e04037a 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -16,7 +16,7 @@ use helix_vcs::DiffProviderRegistry; use futures_util::stream::select_all::SelectAll; use futures_util::{future, StreamExt}; -use helix_lsp::Call; +use helix_lsp::{Call, LanguageServerId}; use tokio_stream::wrappers::UnboundedReceiverStream; use std::{ @@ -960,7 +960,7 @@ pub struct Editor { pub macro_recording: Option<(char, Vec<KeyEvent>)>, pub macro_replaying: Vec<char>, pub language_servers: helix_lsp::Registry, - pub diagnostics: BTreeMap<PathBuf, Vec<(lsp::Diagnostic, usize)>>, + pub diagnostics: BTreeMap<PathBuf, Vec<(lsp::Diagnostic, LanguageServerId)>>, pub diff_providers: DiffProviderRegistry, pub debugger: Option<dap::Client>, @@ -1020,7 +1020,7 @@ pub type Motion = Box<dyn Fn(&mut Editor)>; pub enum EditorEvent { DocumentSaved(DocumentSavedEventResult), ConfigEvent(ConfigEvent), - LanguageServerMessage((usize, Call)), + LanguageServerMessage((LanguageServerId, Call)), DebuggerEvent(dap::Payload), IdleTimer, Redraw, @@ -1260,8 +1260,13 @@ impl Editor { } #[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) + pub fn language_server_by_id( + &self, + language_server_id: LanguageServerId, + ) -> Option<&helix_lsp::Client> { + self.language_servers + .get_by_id(language_server_id) + .map(|client| &**client) } /// Refreshes the language server for a given document @@ -1861,7 +1866,7 @@ impl Editor { /// Returns all supported diagnostics for the document pub fn doc_diagnostics<'a>( language_servers: &'a helix_lsp::Registry, - diagnostics: &'a BTreeMap<PathBuf, Vec<(lsp::Diagnostic, usize)>>, + diagnostics: &'a BTreeMap<PathBuf, Vec<(lsp::Diagnostic, LanguageServerId)>>, document: &Document, ) -> impl Iterator<Item = helix_core::Diagnostic> + 'a { Editor::doc_diagnostics_with_filter(language_servers, diagnostics, document, |_, _| true) @@ -1871,10 +1876,9 @@ impl Editor { /// filtered by `filter` which is invocated with the raw `lsp::Diagnostic` and the language server id it came from pub fn doc_diagnostics_with_filter<'a>( language_servers: &'a helix_lsp::Registry, - diagnostics: &'a BTreeMap<PathBuf, Vec<(lsp::Diagnostic, usize)>>, - + diagnostics: &'a BTreeMap<PathBuf, Vec<(lsp::Diagnostic, LanguageServerId)>>, document: &Document, - filter: impl Fn(&lsp::Diagnostic, usize) -> bool + 'a, + filter: impl Fn(&lsp::Diagnostic, LanguageServerId) -> bool + 'a, ) -> impl Iterator<Item = helix_core::Diagnostic> + 'a { let text = document.text().clone(); let language_config = document.language.clone(); |