aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/ui/picker.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/ui/picker.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/ui/picker.rs')
-rw-r--r--helix-term/src/ui/picker.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/helix-term/src/ui/picker.rs b/helix-term/src/ui/picker.rs
index 4be5a11e..c2728888 100644
--- a/helix-term/src/ui/picker.rs
+++ b/helix-term/src/ui/picker.rs
@@ -461,14 +461,17 @@ impl<T: Item + 'static> Picker<T> {
// Then attempt to highlight it if it has no language set
if doc.language_config().is_none() {
- if let Some(language_config) = doc.detect_language_config(&cx.editor.syn_loader) {
+ if let Some(language_config) = doc.detect_language_config(&cx.editor.syn_loader.load())
+ {
doc.language = Some(language_config.clone());
let text = doc.text().clone();
let loader = cx.editor.syn_loader.clone();
let job = tokio::task::spawn_blocking(move || {
- let syntax = language_config.highlight_config(&loader.scopes()).and_then(
- |highlight_config| Syntax::new(text.slice(..), highlight_config, loader),
- );
+ let syntax = language_config
+ .highlight_config(&loader.load().scopes())
+ .and_then(|highlight_config| {
+ Syntax::new(text.slice(..), highlight_config, loader)
+ });
let callback = move |editor: &mut Editor, compositor: &mut Compositor| {
let Some(syntax) = syntax else {
log::info!("highlighting picker item failed");