From ff0ceb30a9ab4162d0f1241d8b0f9aa531c3c9d2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 31 Dec 2019 18:55:34 +0100 Subject: Add semicolons --- editors/code/src/client.ts | 2 +- editors/code/src/color_theme.ts | 28 ++++++++++++++-------------- editors/code/src/commands/analyzer_status.ts | 2 +- editors/code/src/commands/expand_macro.ts | 2 +- editors/code/src/commands/index.ts | 4 ++-- editors/code/src/commands/syntax_tree.ts | 2 +- editors/code/src/ctx.ts | 14 +++++++------- editors/code/src/highlighting.ts | 12 ++++++------ editors/code/src/inlay_hints.ts | 4 ++-- editors/code/src/source_change.ts | 2 +- editors/code/src/status_display.ts | 2 +- 11 files changed, 37 insertions(+), 37 deletions(-) (limited to 'editors/code/src') diff --git a/editors/code/src/client.ts b/editors/code/src/client.ts index 94948b10f..743384bd7 100644 --- a/editors/code/src/client.ts +++ b/editors/code/src/client.ts @@ -79,7 +79,7 @@ export function createClient(config: Config): lc.LanguageClient { } }, }; - res.registerProposedFeatures() + res.registerProposedFeatures(); return res; } function expandPathResolving(path: string) { diff --git a/editors/code/src/color_theme.ts b/editors/code/src/color_theme.ts index 1df7eba7a..cbad47f35 100644 --- a/editors/code/src/color_theme.ts +++ b/editors/code/src/color_theme.ts @@ -32,29 +32,29 @@ export class ColorTheme { ? [rule.scope] : rule.scope; for (const scope of scopes) { - res.rules.set(scope, rule.settings) + res.rules.set(scope, rule.settings); } } - return res + return res; } lookup(scopes: string[]): TextMateRuleSettings { - let res: TextMateRuleSettings = {} + let res: TextMateRuleSettings = {}; for (const scope of scopes) { this.rules.forEach((value, key) => { if (scope.startsWith(key)) { - res = mergeRuleSettings(res, value) + res = mergeRuleSettings(res, value); } - }) + }); } - return res + return res; } mergeFrom(other: ColorTheme) { other.rules.forEach((value, key) => { - const merged = mergeRuleSettings(this.rules.get(key), value) - this.rules.set(key, merged) - }) + const merged = mergeRuleSettings(this.rules.get(key), value); + this.rules.set(key, merged); + }); } } @@ -73,15 +73,15 @@ function loadThemeNamed(themeName: string): ColorTheme { return ext.packageJSON.contributes.themes .filter((it: any) => (it.id || it.label) === themeName) .map((it: any) => path.join(ext.extensionPath, it.path)); - }) + }); const res = new ColorTheme(); for (const themePath of themePaths) { - res.mergeFrom(loadThemeFile(themePath)) + res.mergeFrom(loadThemeFile(themePath)); } const customizations: any = vscode.workspace.getConfiguration('editor').get('tokenColorCustomizations'); - res.mergeFrom(ColorTheme.fromRules(customizations?.textMateRules ?? [])) + res.mergeFrom(ColorTheme.fromRules(customizations?.textMateRules ?? [])); return res; } @@ -89,7 +89,7 @@ function loadThemeNamed(themeName: string): ColorTheme { function loadThemeFile(themePath: string): ColorTheme { let text; try { - text = fs.readFileSync(themePath, 'utf8') + text = fs.readFileSync(themePath, 'utf8'); } catch { return new ColorTheme(); } @@ -119,5 +119,5 @@ function mergeRuleSettings( foreground: override.foreground ?? defaultSetting?.foreground, background: override.background ?? defaultSetting?.background, fontStyle: override.fontStyle ?? defaultSetting?.fontStyle, - } + }; } diff --git a/editors/code/src/commands/analyzer_status.ts b/editors/code/src/commands/analyzer_status.ts index cf37dc6f0..cfe7d1af0 100644 --- a/editors/code/src/commands/analyzer_status.ts +++ b/editors/code/src/commands/analyzer_status.ts @@ -49,7 +49,7 @@ class TextDocumentContentProvider _uri: vscode.Uri, ): vscode.ProviderResult { const editor = vscode.window.activeTextEditor; - const client = this.ctx.client + const client = this.ctx.client; if (!editor || !client) return ''; return client.sendRequest( diff --git a/editors/code/src/commands/expand_macro.ts b/editors/code/src/commands/expand_macro.ts index 472f43b8d..dcdde78af 100644 --- a/editors/code/src/commands/expand_macro.ts +++ b/editors/code/src/commands/expand_macro.ts @@ -52,7 +52,7 @@ class TextDocumentContentProvider async provideTextDocumentContent(_uri: vscode.Uri): Promise { const editor = vscode.window.activeTextEditor; - const client = this.ctx.client + const client = this.ctx.client; if (!editor || !client) return ''; const position = editor.selection.active; diff --git a/editors/code/src/commands/index.ts b/editors/code/src/commands/index.ts index 4431fdcf6..9a1697dcb 100644 --- a/editors/code/src/commands/index.ts +++ b/editors/code/src/commands/index.ts @@ -36,14 +36,14 @@ function showReferences(ctx: Ctx): Cmd { function applySourceChange(ctx: Ctx): Cmd { return async (change: sourceChange.SourceChange) => { sourceChange.applySourceChange(ctx, change); - } + }; } function reload(ctx: Ctx): Cmd { return async () => { vscode.window.showInformationMessage('Reloading rust-analyzer...'); await ctx.restartServer(); - } + }; } export { diff --git a/editors/code/src/commands/syntax_tree.ts b/editors/code/src/commands/syntax_tree.ts index 2ee80f910..02ea9f166 100644 --- a/editors/code/src/commands/syntax_tree.ts +++ b/editors/code/src/commands/syntax_tree.ts @@ -76,7 +76,7 @@ class TextDocumentContentProvider provideTextDocumentContent(uri: vscode.Uri): vscode.ProviderResult { const editor = vscode.window.activeTextEditor; - const client = this.ctx.client + const client = this.ctx.client; if (!editor || !client) return ''; let range: lc.Range | undefined; diff --git a/editors/code/src/ctx.ts b/editors/code/src/ctx.ts index 13988056a..a2a4e42a9 100644 --- a/editors/code/src/ctx.ts +++ b/editors/code/src/ctx.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; import * as lc from 'vscode-languageclient'; import { Config } from './config'; -import { createClient } from './client' +import { createClient } from './client'; export class Ctx { readonly config: Config; @@ -10,28 +10,28 @@ export class Ctx { // deal with it. // // Ideally, this should be replaced with async getter though. - client: lc.LanguageClient | null = null + client: lc.LanguageClient | null = null; private extCtx: vscode.ExtensionContext; private onDidRestartHooks: Array<(client: lc.LanguageClient) => void> = []; constructor(extCtx: vscode.ExtensionContext) { - this.config = new Config(extCtx) + this.config = new Config(extCtx); this.extCtx = extCtx; } async restartServer() { let old = this.client; if (old) { - await old.stop() + await old.stop(); } this.client = null; const client = createClient(this.config); this.pushCleanup(client.start()); await client.onReady(); - this.client = client + this.client = client; for (const hook of this.onDidRestartHooks) { - hook(client) + hook(client); } } @@ -80,7 +80,7 @@ export class Ctx { } onDidRestart(hook: (client: lc.LanguageClient) => void) { - this.onDidRestartHooks.push(hook) + this.onDidRestartHooks.push(hook); } } diff --git a/editors/code/src/highlighting.ts b/editors/code/src/highlighting.ts index f9d2e9d90..014e96f75 100644 --- a/editors/code/src/highlighting.ts +++ b/editors/code/src/highlighting.ts @@ -30,7 +30,7 @@ export function activateHighlighting(ctx: Ctx) { highlighter.setHighlights(targetEditor, params.decorations); }, ); - }) + }); vscode.workspace.onDidChangeConfiguration( _ => highlighter.removeHighlights(), @@ -173,13 +173,13 @@ class Highlighter { function initDecorations(): Map { const theme = ColorTheme.load(); - const res = new Map() + const res = new Map(); TAG_TO_SCOPES.forEach((scopes, tag) => { - if (!scopes) throw `unmapped tag: ${tag}` - let rule = theme.lookup(scopes) + if (!scopes) throw `unmapped tag: ${tag}`; + let rule = theme.lookup(scopes); const decor = createDecorationFromTextmate(rule); - res.set(tag, decor) - }) + res.set(tag, decor); + }); return res; } diff --git a/editors/code/src/inlay_hints.ts b/editors/code/src/inlay_hints.ts index e74d6996f..6dd767d72 100644 --- a/editors/code/src/inlay_hints.ts +++ b/editors/code/src/inlay_hints.ts @@ -19,7 +19,7 @@ export function activateInlayHints(ctx: Ctx) { hintsUpdater.setEnabled(ctx.config.displayInlayHints); }, ctx.subscriptions); - ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)) + ctx.onDidRestart(_ => hintsUpdater.setEnabled(ctx.config.displayInlayHints)); } interface InlayHintsParams { @@ -96,7 +96,7 @@ class HintsUpdater { private async queryHints(documentUri: string): Promise { let client = this.ctx.client; - if (!client) return null + if (!client) return null; const request: InlayHintsParams = { textDocument: { uri: documentUri }, }; diff --git a/editors/code/src/source_change.ts b/editors/code/src/source_change.ts index 887191d9e..a336269ba 100644 --- a/editors/code/src/source_change.ts +++ b/editors/code/src/source_change.ts @@ -11,7 +11,7 @@ export interface SourceChange { export async function applySourceChange(ctx: Ctx, change: SourceChange) { const client = ctx.client; - if (!client) return + if (!client) return; const wsEdit = client.protocol2CodeConverter.asWorkspaceEdit( change.workspaceEdit, diff --git a/editors/code/src/status_display.ts b/editors/code/src/status_display.ts index 1454bf8b0..08cdc8bdf 100644 --- a/editors/code/src/status_display.ts +++ b/editors/code/src/status_display.ts @@ -9,7 +9,7 @@ export function activateStatusDisplay(ctx: Ctx) { ctx.pushCleanup(statusDisplay); ctx.onDidRestart(client => { client.onNotification('$/progress', params => statusDisplay.handleProgressNotification(params)); - }) + }); } class StatusDisplay implements vscode.Disposable { -- cgit v1.2.3