@@ -2,11 +2,18 @@ use helix_core::syntax;
2use helix_lsp::{lsp, LspProgressMap};
2use helix_lsp::{lsp, LspProgressMap};
3use helix_view::{document::Mode, theme, Document, Editor, Theme, View};
3use helix_view::{document::Mode, theme, Document, Editor, Theme, View};
5−use crate::{args::Args, compositor::Compositor, config::Config, keymap::Keymaps, ui};
7+ compositor::Compositor,
7use log::{error, info};
13use log::{error, info};
16+ collections::HashMap,
10 future::Future,
17 future::Future,
11 io::{self, stdout, Stdout, Write},
18 io::{self, stdout, Stdout, Write},
12 path::PathBuf,
19 path::PathBuf,
@@ -42,7 +49,7 @@ pub struct Application {
42 callbacks: LspCallbacks,
49 callbacks: LspCallbacks,
44 lsp_progress: LspProgressMap,
51 lsp_progress: LspProgressMap,
45− lsp_progress_enabled: bool,
52+ lsp_display_messages: bool,
48impl Application {
55impl Application {
@@ -62,7 +69,7 @@ impl Application {
62 .as_deref()
69 .as_deref()
63 .unwrap_or(include_bytes!("../../languages.toml"));
70 .unwrap_or(include_bytes!("../../languages.toml"));
65− let theme = if let Some(theme) = &config.global.theme {
72+ let theme = if let Some(theme) = &config.theme {
66 match theme_loader.load(theme) {
73 match theme_loader.load(theme) {
67 Ok(theme) => theme,
74 Ok(theme) => theme,
68 Err(e) => {
75 Err(e) => {
@@ -112,7 +119,7 @@ impl Application {
112 syn_loader,
119 syn_loader,
113 callbacks: FuturesUnordered::new(),
120 callbacks: FuturesUnordered::new(),
114 lsp_progress: LspProgressMap::new(),
121 lsp_progress: LspProgressMap::new(),
115− lsp_progress_enabled: config.global.lsp_progress,
122+ lsp_display_messages: config.lsp.display_messages,
@@ -305,11 +312,23 @@ impl Application {
305 (None, message, &None)
312 (None, message, &None)
307 self.lsp_progress.end_progress(server_id, &token);
314 self.lsp_progress.end_progress(server_id, &token);
315+ if !self.lsp_progress.is_progressing(server_id) {
318+ .find(std::any::type_name::<ui::EditorView>())
321+ ui.as_any_mut().downcast_mut::<ui::EditorView>()
323+ ui.spinners_mut().get_or_create(server_id).stop();
308 self.editor.clear_status();
326 self.editor.clear_status();
313 let token_d: &dyn std::fmt::Display = match &token {
332 let token_d: &dyn std::fmt::Display = match &token {
314 lsp::NumberOrString::Number(n) => n,
333 lsp::NumberOrString::Number(n) => n,
315 lsp::NumberOrString::String(s) => s,
334 lsp::NumberOrString::String(s) => s,
@@ -342,14 +361,23 @@ impl Application {
343 if let lsp::WorkDoneProgress::End(_) = work {
362 if let lsp::WorkDoneProgress::End(_) = work {
344 self.lsp_progress.end_progress(server_id, &token);
363 self.lsp_progress.end_progress(server_id, &token);
364+ if !self.lsp_progress.is_progressing(server_id) {
367+ .find(std::any::type_name::<ui::EditorView>())
369+ if let Some(ui) = ui.as_any_mut().downcast_mut::<ui::EditorView>() {
370+ ui.spinners_mut().get_or_create(server_id).stop();
346 self.lsp_progress.update(server_id, token, work);
374 self.lsp_progress.update(server_id, token, work);
349− if self.lsp_progress_enabled {
377+ if self.lsp_display_messages {
350 self.editor.set_status(status);
378 self.editor.set_status(status);
354 _ => unreachable!(),
382 _ => unreachable!(),
@@ -372,6 +400,17 @@ impl Application {
372 MethodCall::WorkDoneProgressCreate(params) => {
400 MethodCall::WorkDoneProgressCreate(params) => {
373 self.lsp_progress.create(server_id, params.token);
401 self.lsp_progress.create(server_id, params.token);
405+ .find(std::any::type_name::<ui::EditorView>())
407+ if let Some(ui) = ui.as_any_mut().downcast_mut::<ui::EditorView>() {
408+ let spinner = ui.spinners_mut().get_or_create(server_id);
409+ if spinner.is_stopped() {
375 let doc = self.editor.documents().find(|doc| {
414 let doc = self.editor.documents().find(|doc| {
376 doc.language_server()
415 doc.language_server()
377 .map(|server| server.id() == server_id)
416 .map(|server| server.id() == server_id)