From fe869e5dc7a8cd6c2c2e3945816bd890956eef3a Mon Sep 17 00:00:00 2001 From: kyfanc Date: Tue, 13 Feb 2024 18:58:53 +0800 Subject: 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 --- helix-view/src/editor.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'helix-view/src/editor.rs') diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 0fa6d67c..68b74cf0 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -50,7 +50,10 @@ use helix_stdx::path::canonicalize; use serde::{ser::SerializeMap, Deserialize, Deserializer, Serialize, Serializer}; -use arc_swap::access::{DynAccess, DynGuard}; +use arc_swap::{ + access::{DynAccess, DynGuard}, + ArcSwap, +}; fn deserialize_duration_millis<'de, D>(deserializer: D) -> Result where @@ -918,7 +921,7 @@ pub struct Editor { pub debugger_events: SelectAll>, pub breakpoints: HashMap>, - pub syn_loader: Arc, + pub syn_loader: Arc>, pub theme_loader: Arc, /// last_theme is used for theme previews. We store the current theme here, /// and if previewing is cancelled, we can return to it. @@ -1029,7 +1032,7 @@ impl Editor { pub fn new( mut area: Rect, theme_loader: Arc, - syn_loader: Arc, + syn_loader: Arc>, config: Arc>, handlers: Handlers, ) -> Self { @@ -1190,7 +1193,7 @@ impl Editor { } let scopes = theme.scopes(); - self.syn_loader.set_scopes(scopes.to_vec()); + (*self.syn_loader).load().set_scopes(scopes.to_vec()); match preview { ThemeAction::Preview => { -- cgit v1.2.3-70-g09d2