From 3717b0e03f2336dcccea34c5a362b20966151b18 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 17 Feb 2020 14:23:23 +0100 Subject: Simplify some more ctors --- editors/code/src/commands/analyzer_status.ts | 4 +--- editors/code/src/commands/expand_macro.ts | 4 +--- editors/code/src/commands/syntax_tree.ts | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) (limited to 'editors/code/src') diff --git a/editors/code/src/commands/analyzer_status.ts b/editors/code/src/commands/analyzer_status.ts index cfe7d1af0..6631e8db7 100644 --- a/editors/code/src/commands/analyzer_status.ts +++ b/editors/code/src/commands/analyzer_status.ts @@ -37,12 +37,10 @@ export function analyzerStatus(ctx: Ctx): Cmd { class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - private ctx: Ctx; uri = vscode.Uri.parse('rust-analyzer-status://status'); eventEmitter = new vscode.EventEmitter(); - constructor(ctx: Ctx) { - this.ctx = ctx; + constructor(private readonly ctx: Ctx) { } provideTextDocumentContent( diff --git a/editors/code/src/commands/expand_macro.ts b/editors/code/src/commands/expand_macro.ts index dcdde78af..6fee6eb41 100644 --- a/editors/code/src/commands/expand_macro.ts +++ b/editors/code/src/commands/expand_macro.ts @@ -42,12 +42,10 @@ function code_format(expanded: ExpandedMacro): string { class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - private ctx: Ctx; uri = vscode.Uri.parse('rust-analyzer://expandMacro/[EXPANSION].rs'); eventEmitter = new vscode.EventEmitter(); - constructor(ctx: Ctx) { - this.ctx = ctx; + constructor(private readonly ctx: Ctx) { } async provideTextDocumentContent(_uri: vscode.Uri): Promise { diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/commands/syntax_tree.ts index 7dde66ad1..2887c96c8 100644 --- a/editors/code/src/commands/syntax_tree.ts +++ b/editors/code/src/commands/syntax_tree.ts @@ -68,12 +68,10 @@ interface SyntaxTreeParams { class TextDocumentContentProvider implements vscode.TextDocumentContentProvider { - private ctx: Ctx; uri = vscode.Uri.parse('rust-analyzer://syntaxtree'); eventEmitter = new vscode.EventEmitter(); - constructor(ctx: Ctx) { - this.ctx = ctx; + constructor(private readonly ctx: Ctx) { } provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult { -- cgit v1.2.3