diff --git a/crates/flycheck/src/test_runner.rs b/crates/flycheck/src/test_runner.rs index 6dac5899ee3a..31378716b3ec 100644 --- a/crates/flycheck/src/test_runner.rs +++ b/crates/flycheck/src/test_runner.rs @@ -28,19 +28,20 @@ pub enum CargoTestMessage { }, Suite, Finished, + Custom { + text: String, + }, } impl ParseFromLine for CargoTestMessage { - fn from_line(line: &str, error: &mut String) -> Option { + fn from_line(line: &str, _: &mut String) -> Option { let mut deserializer = serde_json::Deserializer::from_str(line); deserializer.disable_recursion_limit(); if let Ok(message) = CargoTestMessage::deserialize(&mut deserializer) { return Some(message); } - error.push_str(line); - error.push('\n'); - None + Some(CargoTestMessage::Custom { text: line.to_owned() }) } fn from_eof() -> Option { diff --git a/crates/rust-analyzer/src/lsp/ext.rs b/crates/rust-analyzer/src/lsp/ext.rs index 86ab652f8ef5..710ce7f8acbb 100644 --- a/crates/rust-analyzer/src/lsp/ext.rs +++ b/crates/rust-analyzer/src/lsp/ext.rs @@ -234,6 +234,13 @@ impl Notification for EndRunTest { const METHOD: &'static str = "experimental/endRunTest"; } +pub enum AppendOutputToRunTest {} + +impl Notification for AppendOutputToRunTest { + type Params = String; + const METHOD: &'static str = "experimental/appendOutputToRunTest"; +} + pub enum AbortRunTest {} impl Notification for AbortRunTest { diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index e106a85c6eb8..ffe56e41435c 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -799,6 +799,9 @@ impl GlobalState { self.send_notification::(()); self.test_run_session = None; } + flycheck::CargoTestMessage::Custom { text } => { + self.send_notification::(text); + } } } diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index af5b4e51ef37..cf9ad5fe04dd 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md @@ -1,5 +1,5 @@