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.ts41
1 files changed, 16 insertions, 25 deletions
diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts
index 4248305d5c..ac73f2ae6b 100644
--- a/editors/code/src/ctx.ts
+++ b/editors/code/src/ctx.ts
@@ -34,13 +34,8 @@ import type { RustAnalyzerExtensionApi } from "./main";
export type Workspace =
| { kind: "Empty" }
- | {
- kind: "Workspace Folder";
- }
- | {
- kind: "Detached Files";
- files: vscode.TextDocument[];
- };
+ | { kind: "Workspace Folder" }
+ | { kind: "Detached Files"; files: vscode.TextDocument[] };
export function fetchWorkspace(): Workspace {
const folders = (vscode.workspace.workspaceFolders || []).filter(
@@ -53,10 +48,7 @@ export function fetchWorkspace(): Workspace {
return folders.length === 0
? rustDocuments.length === 0
? { kind: "Empty" }
- : {
- kind: "Detached Files",
- files: rustDocuments,
- }
+ : { kind: "Detached Files", files: rustDocuments }
: { kind: "Workspace Folder" };
}
@@ -89,6 +81,7 @@ export class Ctx implements RustAnalyzerExtensionApi {
private _dependencyTreeView:
| vscode.TreeView<Dependency | DependencyFile | DependencyId>
| undefined;
+
private _syntaxTreeProvider: SyntaxTreeProvider | undefined;
private _syntaxTreeView: vscode.TreeView<SyntaxElement> | undefined;
private lastStatus: ServerStatusParams | { health: "stopped" } = { health: "stopped" };
@@ -267,7 +260,7 @@ export class Ctx implements RustAnalyzerExtensionApi {
let message = "bootstrap error. ";
message +=
- 'See the logs in "OUTPUT > Rust Analyzer Client" (should open automatically). ';
+ 'See the logs in "OUTPUT > Rust Analyzer Client" (should open automatically).';
message +=
'To enable verbose logs, click the gear icon in the "OUTPUT" tab and select "Debug".';
@@ -476,9 +469,11 @@ export class Ctx implements RustAnalyzerExtensionApi {
this.lastStatus = status;
this.updateStatusBarItem();
}
+
refreshServerStatus() {
this.updateStatusBarItem();
}
+
private updateStatusBarItem() {
let icon = "";
const status = this.lastStatus;
@@ -533,19 +528,14 @@ export class Ctx implements RustAnalyzerExtensionApi {
const toggleCheckOnSave = this.config.checkOnSave ? "Disable" : "Enable";
statusBar.tooltip.appendMarkdown(
- `[Extension Info](command:rust-analyzer.serverVersion "Show version and server binary info"): Version ${this.version}, Server Version ${this._serverVersion}` +
- "\n\n---\n\n" +
- '[$(terminal) Open Logs](command:rust-analyzer.openLogs "Open the server logs")' +
- "\n\n" +
- `[$(settings) ${toggleCheckOnSave} Check on Save](command:rust-analyzer.toggleCheckOnSave "Temporarily ${toggleCheckOnSave.toLowerCase()} check on save functionality")` +
- "\n\n" +
- '[$(refresh) Reload Workspace](command:rust-analyzer.reloadWorkspace "Reload and rediscover workspaces")' +
- "\n\n" +
- '[$(symbol-property) Rebuild Build Dependencies](command:rust-analyzer.rebuildProcMacros "Rebuild build scripts and proc-macros")' +
- "\n\n" +
- '[$(stop-circle) Stop server](command:rust-analyzer.stopServer "Stop the server")' +
- "\n\n" +
- '[$(debug-restart) Restart server](command:rust-analyzer.restartServer "Restart the server")',
+ `[Extension Info](command:rust-analyzer.serverVersion "Show version and server binary info"): Version ${this.version}, Server Version ${this._serverVersion}\n\n` +
+ `---\n\n` +
+ `[$(terminal) Open Logs](command:rust-analyzer.openLogs "Open the server logs")\n\n` +
+ `[$(settings) ${toggleCheckOnSave} Check on Save](command:rust-analyzer.toggleCheckOnSave "Temporarily ${toggleCheckOnSave.toLowerCase()} check on save functionality")\n\n` +
+ `[$(refresh) Reload Workspace](command:rust-analyzer.reloadWorkspace "Reload and rediscover workspaces")\n\n` +
+ `[$(symbol-property) Rebuild Build Dependencies](command:rust-analyzer.rebuildProcMacros "Rebuild build scripts and proc-macros")\n\n` +
+ `[$(stop-circle) Stop server](command:rust-analyzer.stopServer "Stop the server")\n\n` +
+ `[$(debug-restart) Restart server](command:rust-analyzer.restartServer "Restart the server")`,
);
if (!status.quiescent) icon = "$(loading~spin) ";
statusBar.text = `${icon}rust-analyzer`;
@@ -580,4 +570,5 @@ export interface Disposable {
dispose(): void;
}
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type Cmd = (...args: any[]) => unknown;