summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--helix-term/src/application.rs33
-rw-r--r--helix-term/src/compositor.rs6
2 files changed, 30 insertions, 9 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index c39a9173..7667441b 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -295,14 +295,6 @@ impl Application {
server_id: usize,
) {
use helix_lsp::{Call, MethodCall, Notification};
- let editor_view = self
- .compositor
- .find(std::any::type_name::<ui::EditorView>())
- .expect("expected at least one EditorView");
- let editor_view = editor_view
- .as_any_mut()
- .downcast_mut::<ui::EditorView>()
- .unwrap();
match call {
Call::Notification(helix_lsp::jsonrpc::Notification { method, params, .. }) => {
@@ -412,7 +404,19 @@ impl Application {
Notification::LogMessage(params) => {
log::info!("window/logMessage: {:?}", params);
}
- Notification::ProgressMessage(params) => {
+ Notification::ProgressMessage(params)
+ if !self
+ .compositor
+ .has_component(std::any::type_name::<ui::Prompt>()) =>
+ {
+ let editor_view = self
+ .compositor
+ .find(std::any::type_name::<ui::EditorView>())
+ .expect("expected at least one EditorView");
+ let editor_view = editor_view
+ .as_any_mut()
+ .downcast_mut::<ui::EditorView>()
+ .unwrap();
let lsp::ProgressParams { token, value } = params;
let lsp::ProgressParamsValue::WorkDone(work) = value;
@@ -487,6 +491,9 @@ impl Application {
self.editor.set_status(status);
}
}
+ Notification::ProgressMessage(_params) => {
+ // do nothing
+ }
}
}
Call::MethodCall(helix_lsp::jsonrpc::MethodCall {
@@ -521,6 +528,14 @@ impl Application {
MethodCall::WorkDoneProgressCreate(params) => {
self.lsp_progress.create(server_id, params.token);
+ let editor_view = self
+ .compositor
+ .find(std::any::type_name::<ui::EditorView>())
+ .expect("expected at least one EditorView");
+ let editor_view = editor_view
+ .as_any_mut()
+ .downcast_mut::<ui::EditorView>()
+ .unwrap();
let spinner = editor_view.spinners_mut().get_or_create(server_id);
if spinner.is_stopped() {
spinner.start();
diff --git a/helix-term/src/compositor.rs b/helix-term/src/compositor.rs
index 36e54ede..cad1df05 100644
--- a/helix-term/src/compositor.rs
+++ b/helix-term/src/compositor.rs
@@ -171,6 +171,12 @@ impl Compositor {
(None, CursorKind::Hidden)
}
+ pub fn has_component(&self, type_name: &str) -> bool {
+ self.layers
+ .iter()
+ .any(|component| component.type_name() == type_name)
+ }
+
pub fn find(&mut self, type_name: &str) -> Option<&mut dyn Component> {
self.layers
.iter_mut()