Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'editors/code/src/ctx.ts')
| -rw-r--r-- | editors/code/src/ctx.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index 01a3aca132..9be846f969 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts @@ -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); } } |