The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.
TypeScript code-editorcross-platformdapdatabase-clientdebuggerdesktop-appdeveloper-toolsgithttp-clientideintellijlsprusttauriterminal
fix(lsp): keep rust-analyzer's developer notices out of notifications (#1597)
l0ng-ai07df51f308a5
diff --git a/crates/ide-lsp/src/handler.rs b/crates/ide-lsp/src/handler.rsindex c8b8f9f05..17650b117 100644--- a/crates/ide-lsp/src/handler.rs+++ b/crates/ide-lsp/src/handler.rs@@ -136,6 +136,12 @@ impl ClientHandler {fn show_message(&self, mgr: &LspManager, params: &Value) {let text = params.get("message").and_then(Value::as_str).unwrap_or_default().to_owned();+ // rust-analyzer built from source reports its own slow main-loop turns as errors, meant for+ // its developers (`poke_rust_analyzer_developer`); nothing for the user to act on.+ if text.starts_with("overly long loop turn") {+ tracing::warn!("[{}] {text}", self.server.name);+ return;+ }let level = match params.get("type").and_then(Value::as_u64) {Some(1) => NotifyLevel::Error,Some(2) => NotifyLevel::Warning,diff --git a/crates/ide-lsp/tests/mock_server.rs b/crates/ide-lsp/tests/mock_server.rsindex c1cc65ff7..8642c576d 100644--- a/crates/ide-lsp/tests/mock_server.rs+++ b/crates/ide-lsp/tests/mock_server.rs@@ -954,6 +954,11 @@ async fn apply_edit_hook_and_server_requests() {assert_eq!(v, Value::Null);assert!(peer.request::<_, Value>("unknown/method", Value::Null, None).await.is_err());+ peer.notify(+ "window/showMessage",+ json!({ "type": 1, "message": "overly long loop turn took 113ms (event handling took 95ms): PrimeCaches" }),+ )+ .unwrap();peer.notify("window/showMessage", json!({ "type": 2, "message": "careful" })).unwrap();peer.notify("window/showMessage", json!({ "type": 3, "message": "info only" })).unwrap();peer.notify("window/logMessage", json!({ "type": 1, "message": "log" })).unwrap();@@ -962,7 +967,10 @@ async fn apply_edit_hook_and_server_requests() {}).await;let notifies = h.events.lock().iter().filter(|e| matches!(e, IdeEvent::Notify { .. })).count();- assert_eq!(notifies, 2, "showMessageRequest error + showMessage warning; info is not surfaced");+ assert_eq!(+ notifies, 2,+ "showMessageRequest error + showMessage warning; info and rust-analyzer's developer notices are not surfaced"+ );// Dynamically registered capability is now usable.s.respond(