diff options
author | kyfanc | 2024-02-13 10:58:53 +0000 |
---|---|---|
committer | GitHub | 2024-02-13 10:58:53 +0000 |
commit | fe869e5dc7a8cd6c2c2e3945816bd890956eef3a (patch) | |
tree | ad0b899b482df976caf3cc2f079dc7d0d8a3769f /helix-term/src/ui/prompt.rs | |
parent | 7934ac77143e69068420556b043dde035255340b (diff) |
fix lsp config reload (#9415)
`syn_loader` was replaced rather than interior value being replace,
old value was still being referenced and not updated after `:config-refresh`.
By using `ArcSwap` like for `config`, each `.load()` call will return the most
updated value.
Co-authored-by: kyfan <kyfan@email>
Diffstat (limited to 'helix-term/src/ui/prompt.rs')
-rw-r--r-- | helix-term/src/ui/prompt.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index 3764bba6..a6ee7f05 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -1,5 +1,6 @@ use crate::compositor::{Component, Compositor, Context, Event, EventResult}; use crate::{alt, ctrl, key, shift, ui}; +use arc_swap::ArcSwap; use helix_core::syntax; use helix_view::input::KeyEvent; use helix_view::keyboard::KeyCode; @@ -34,7 +35,7 @@ pub struct Prompt { callback_fn: CallbackFn, pub doc_fn: DocFn, next_char_handler: Option<PromptCharHandler>, - language: Option<(&'static str, Arc<syntax::Loader>)>, + language: Option<(&'static str, Arc<ArcSwap<syntax::Loader>>)>, } #[derive(Clone, Copy, PartialEq, Eq)] @@ -98,7 +99,11 @@ impl Prompt { self } - pub fn with_language(mut self, language: &'static str, loader: Arc<syntax::Loader>) -> Self { + pub fn with_language( + mut self, + language: &'static str, + loader: Arc<ArcSwap<syntax::Loader>>, + ) -> Self { self.language = Some((language, loader)); self } |