mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-01 20:31:59 +00:00
Some minor changes in the test explorer lsp extension
This commit is contained in:
parent
ce15e73a8e
commit
dc99ad912a
7 changed files with 45 additions and 15 deletions
|
|
@ -76,7 +76,7 @@ export type RunTestParams = {
|
|||
export type TestItem = {
|
||||
id: string;
|
||||
label: string;
|
||||
icon: "package" | "module" | "test";
|
||||
kind: "package" | "module" | "test";
|
||||
canResolveChildren: boolean;
|
||||
parent?: string | undefined;
|
||||
textDocument?: lc.TextDocumentIdentifier | undefined;
|
||||
|
|
@ -84,7 +84,12 @@ export type TestItem = {
|
|||
runnable?: Runnable | undefined;
|
||||
};
|
||||
export type DiscoverTestResults = { tests: TestItem[]; scope: string[] };
|
||||
export type TestState = { tag: "failed"; message: string } | { tag: "passed" } | { tag: "started" };
|
||||
export type TestState =
|
||||
| { tag: "failed"; message: string }
|
||||
| { tag: "passed" }
|
||||
| { tag: "started" }
|
||||
| { tag: "enqueued" }
|
||||
| { tag: "skipped" };
|
||||
export type ChangeTestStateParams = { testId: string; state: TestState };
|
||||
export const discoverTest = new lc.RequestType<DiscoverTestParams, DiscoverTestResults, void>(
|
||||
"experimental/discoverTest",
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ export const prepareTestExplorer = (
|
|||
};
|
||||
const test = testController.createTestItem(
|
||||
item.id,
|
||||
`$(${iconToVscodeMap[item.icon]}) ${item.label}`,
|
||||
`$(${iconToVscodeMap[item.kind]}) ${item.label}`,
|
||||
uri,
|
||||
);
|
||||
test.range = range;
|
||||
|
|
@ -150,6 +150,10 @@ export const prepareTestExplorer = (
|
|||
currentTestRun!.passed(test);
|
||||
} else if (results.state.tag === "started") {
|
||||
currentTestRun!.started(test);
|
||||
} else if (results.state.tag === "skipped") {
|
||||
currentTestRun!.skipped(test);
|
||||
} else if (results.state.tag === "enqueued") {
|
||||
currentTestRun!.enqueued(test);
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue