Auto merge of #16845 - HKalbasi:test-explorer, r=HKalbasi
Show compilation progress in test explorer Fix part of #16827
This commit is contained in:
commit
f9a4d05195
@ -28,19 +28,20 @@ pub enum CargoTestMessage {
|
|||||||
},
|
},
|
||||||
Suite,
|
Suite,
|
||||||
Finished,
|
Finished,
|
||||||
|
Custom {
|
||||||
|
text: String,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ParseFromLine for CargoTestMessage {
|
impl ParseFromLine for CargoTestMessage {
|
||||||
fn from_line(line: &str, error: &mut String) -> Option<Self> {
|
fn from_line(line: &str, _: &mut String) -> Option<Self> {
|
||||||
let mut deserializer = serde_json::Deserializer::from_str(line);
|
let mut deserializer = serde_json::Deserializer::from_str(line);
|
||||||
deserializer.disable_recursion_limit();
|
deserializer.disable_recursion_limit();
|
||||||
if let Ok(message) = CargoTestMessage::deserialize(&mut deserializer) {
|
if let Ok(message) = CargoTestMessage::deserialize(&mut deserializer) {
|
||||||
return Some(message);
|
return Some(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
error.push_str(line);
|
Some(CargoTestMessage::Custom { text: line.to_owned() })
|
||||||
error.push('\n');
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_eof() -> Option<Self> {
|
fn from_eof() -> Option<Self> {
|
||||||
|
@ -234,6 +234,13 @@ impl Notification for EndRunTest {
|
|||||||
const METHOD: &'static str = "experimental/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 {}
|
pub enum AbortRunTest {}
|
||||||
|
|
||||||
impl Notification for AbortRunTest {
|
impl Notification for AbortRunTest {
|
||||||
|
@ -799,6 +799,9 @@ fn handle_cargo_test_msg(&mut self, message: flycheck::CargoTestMessage) {
|
|||||||
self.send_notification::<lsp_ext::EndRunTest>(());
|
self.send_notification::<lsp_ext::EndRunTest>(());
|
||||||
self.test_run_session = None;
|
self.test_run_session = None;
|
||||||
}
|
}
|
||||||
|
flycheck::CargoTestMessage::Custom { text } => {
|
||||||
|
self.send_notification::<lsp_ext::AppendOutputToRunTest>(text);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<!---
|
<!---
|
||||||
lsp/ext.rs hash: 6bc140531b403717
|
lsp/ext.rs hash: 61f485497d6e8e88
|
||||||
|
|
||||||
If you need to change the above hash to make the test pass, please check if you
|
If you need to change the above hash to make the test pass, please check if you
|
||||||
need to adjust this doc as well and ping this issue:
|
need to adjust this doc as well and ping this issue:
|
||||||
@ -509,6 +509,13 @@ interface ChangeTestStateParams {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Method:** `experimental/appendOutputToRunTest`
|
||||||
|
|
||||||
|
**Notification:** `string`
|
||||||
|
|
||||||
|
This notification is used for reporting messages independent of any single test and related to the run session
|
||||||
|
in general, e.g. cargo compiling progress messages or warnings.
|
||||||
|
|
||||||
## Open External Documentation
|
## Open External Documentation
|
||||||
|
|
||||||
This request is sent from the client to the server to obtain web and local URL(s) for documentation related to the symbol under the cursor, if available.
|
This request is sent from the client to the server to obtain web and local URL(s) for documentation related to the symbol under the cursor, if available.
|
||||||
|
@ -100,6 +100,9 @@ export const discoveredTests = new lc.NotificationType<DiscoverTestResults>(
|
|||||||
export const runTest = new lc.RequestType<RunTestParams, void, void>("experimental/runTest");
|
export const runTest = new lc.RequestType<RunTestParams, void, void>("experimental/runTest");
|
||||||
export const abortRunTest = new lc.NotificationType0("experimental/abortRunTest");
|
export const abortRunTest = new lc.NotificationType0("experimental/abortRunTest");
|
||||||
export const endRunTest = new lc.NotificationType0("experimental/endRunTest");
|
export const endRunTest = new lc.NotificationType0("experimental/endRunTest");
|
||||||
|
export const appendOutputToRunTest = new lc.NotificationType<string>(
|
||||||
|
"experimental/appendOutputToRunTest",
|
||||||
|
);
|
||||||
export const changeTestState = new lc.NotificationType<ChangeTestStateParams>(
|
export const changeTestState = new lc.NotificationType<ChangeTestStateParams>(
|
||||||
"experimental/changeTestState",
|
"experimental/changeTestState",
|
||||||
);
|
);
|
||||||
|
@ -141,6 +141,12 @@ export const prepareTestExplorer = (
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
ctx.pushClientCleanup(
|
||||||
|
client.onNotification(ra.appendOutputToRunTest, (output) => {
|
||||||
|
currentTestRun!.appendOutput(`${output}\r\n`);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
ctx.pushClientCleanup(
|
ctx.pushClientCleanup(
|
||||||
client.onNotification(ra.changeTestState, (results) => {
|
client.onNotification(ra.changeTestState, (results) => {
|
||||||
const test = idToTestMap.get(results.testId)!;
|
const test = idToTestMap.get(results.testId)!;
|
||||||
|
Loading…
Reference in New Issue
Block a user