mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Add test explorer
This commit is contained in:
parent
916914418a
commit
44be2432f5
19 changed files with 1083 additions and 172 deletions
|
@ -24,6 +24,7 @@ import { PersistentState } from "./persistent_state";
|
|||
import { bootstrap } from "./bootstrap";
|
||||
import type { RustAnalyzerExtensionApi } from "./main";
|
||||
import type { JsonProject } from "./rust_project";
|
||||
import { prepareTestExplorer } from "./test_explorer";
|
||||
|
||||
// We only support local folders, not eg. Live Share (`vlsl:` scheme), so don't activate if
|
||||
// only those are in use. We use "Empty" to represent these scenarios
|
||||
|
@ -74,6 +75,7 @@ export class Ctx implements RustAnalyzerExtensionApi {
|
|||
private _client: lc.LanguageClient | undefined;
|
||||
private _serverPath: string | undefined;
|
||||
private traceOutputChannel: vscode.OutputChannel | undefined;
|
||||
private testController: vscode.TestController;
|
||||
private outputChannel: vscode.OutputChannel | undefined;
|
||||
private clientSubscriptions: Disposable[];
|
||||
private state: PersistentState;
|
||||
|
@ -103,6 +105,10 @@ export class Ctx implements RustAnalyzerExtensionApi {
|
|||
) {
|
||||
extCtx.subscriptions.push(this);
|
||||
this.statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left);
|
||||
this.testController = vscode.tests.createTestController(
|
||||
"rustAnalyzerTestController",
|
||||
"Rust Analyzer test controller",
|
||||
);
|
||||
this.workspace = workspace;
|
||||
this.clientSubscriptions = [];
|
||||
this.commandDisposables = [];
|
||||
|
@ -120,6 +126,7 @@ export class Ctx implements RustAnalyzerExtensionApi {
|
|||
dispose() {
|
||||
this.config.dispose();
|
||||
this.statusBar.dispose();
|
||||
this.testController.dispose();
|
||||
void this.disposeClient();
|
||||
this.commandDisposables.forEach((disposable) => disposable.dispose());
|
||||
}
|
||||
|
@ -264,6 +271,7 @@ export class Ctx implements RustAnalyzerExtensionApi {
|
|||
await client.start();
|
||||
this.updateCommands();
|
||||
|
||||
prepareTestExplorer(this, this.testController, client);
|
||||
if (this.config.showDependenciesExplorer) {
|
||||
this.prepareTreeDependenciesView(client);
|
||||
}
|
||||
|
@ -491,7 +499,7 @@ export class Ctx implements RustAnalyzerExtensionApi {
|
|||
this.extCtx.subscriptions.push(d);
|
||||
}
|
||||
|
||||
private pushClientCleanup(d: Disposable) {
|
||||
pushClientCleanup(d: Disposable) {
|
||||
this.clientSubscriptions.push(d);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue