aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/application.rs
diff options
context:
space:
mode:
authorkyfanc2024-02-13 10:58:53 +0000
committerGitHub2024-02-13 10:58:53 +0000
commitfe869e5dc7a8cd6c2c2e3945816bd890956eef3a (patch)
treead0b899b482df976caf3cc2f079dc7d0d8a3769f /helix-term/src/application.rs
parent7934ac77143e69068420556b043dde035255340b (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/application.rs')
-rw-r--r--helix-term/src/application.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index b844b5f0..30df3981 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -66,7 +66,7 @@ pub struct Application {
#[allow(dead_code)]
theme_loader: Arc<theme::Loader>,
#[allow(dead_code)]
- syn_loader: Arc<syntax::Loader>,
+ syn_loader: Arc<ArcSwap<syntax::Loader>>,
signals: Signals,
jobs: Jobs,
@@ -122,7 +122,7 @@ impl Application {
})
.unwrap_or_else(|| theme_loader.default_theme(true_color));
- let syn_loader = std::sync::Arc::new(lang_loader);
+ let syn_loader = Arc::new(ArcSwap::from_pointee(lang_loader));
#[cfg(not(feature = "integration"))]
let backend = CrosstermBackend::new(stdout(), &config.editor);
@@ -391,7 +391,8 @@ impl Application {
/// refresh language config after config change
fn refresh_language_config(&mut self) -> Result<(), Error> {
let lang_loader = helix_core::config::user_lang_loader()?;
- self.syn_loader = std::sync::Arc::new(lang_loader);
+
+ self.syn_loader.store(Arc::new(lang_loader));
self.editor.syn_loader = self.syn_loader.clone();
for document in self.editor.documents.values_mut() {
document.detect_language(self.syn_loader.clone());