From c7fd7e90b958778f3ee4e80e5708bab803ea165c Mon Sep 17 00:00:00 2001 From: Marcel Joss Date: Tue, 18 Jul 2023 20:32:42 +0200 Subject: [PATCH] chore(format): run prettier 3 --- src/extension.ts | 13 +++++++------ src/getJava.ts | 6 +++--- src/github.ts | 4 ++-- src/languageServerController.ts | 10 +++++----- src/samtTaskProvider.ts | 16 ++++++++-------- src/test/suite/grammar.test.ts | 8 ++++---- 6 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index e185754..a18f556 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -7,29 +7,30 @@ let languageServerController: LanguageServerController | null = null; async function enableTrustedFunctionality(context: vscode.ExtensionContext) { languageServerController = new LanguageServerController(context); context.subscriptions.push( - vscode.commands.registerCommand("samt.restartSamtServer", () => - languageServerController?.restart() + vscode.commands.registerCommand( + "samt.restartSamtServer", + () => languageServerController?.restart(), ), vscode.workspace.onDidChangeConfiguration(async (event) => { if (event.affectsConfiguration("samt")) { await languageServerController?.restart(); } }), - vscode.tasks.registerTaskProvider("samt", new SamtTaskProvider()) + vscode.tasks.registerTaskProvider("samt", new SamtTaskProvider()), ); await languageServerController.start(); } export async function activate( - context: vscode.ExtensionContext + context: vscode.ExtensionContext, ): Promise { if (vscode.workspace.isTrusted) { await enableTrustedFunctionality(context); } else { context.subscriptions.push( vscode.workspace.onDidGrantWorkspaceTrust(() => - enableTrustedFunctionality(context) - ) + enableTrustedFunctionality(context), + ), ); } } diff --git a/src/getJava.ts b/src/getJava.ts index 1ff4526..f2719fc 100644 --- a/src/getJava.ts +++ b/src/getJava.ts @@ -26,7 +26,7 @@ type JavaRuntime = IJavaRuntime & { function convertJre( jre: IJavaRuntime, - javaInPath: string | null = null + javaInPath: string | null = null, ): JavaRuntime { const { homedir, version, isJavaHomeEnv, isJdkHomeEnv, isInPathEnv } = jre; if (version == null) { @@ -157,12 +157,12 @@ export default async function getJava(): Promise { async function showMissingJavaError(): Promise { const item = await vscode.window.showErrorMessage( `The SAMT language server requires Java ${minimumVersion} or later to be installed. If the automatic detection failed, please configure the path to the Java home directory in the SAMT extension settings.`, - OPEN_SETTINGS + OPEN_SETTINGS, ); if (item === OPEN_SETTINGS) { await vscode.commands.executeCommand( "workbench.action.openSettings", - "samt.java.home" + "samt.java.home", ); } } diff --git a/src/github.ts b/src/github.ts index bb8edf3..7740efa 100644 --- a/src/github.ts +++ b/src/github.ts @@ -18,10 +18,10 @@ interface GithubRelease { export async function getLatestReleaseAsset( repository: string, - assetName: string + assetName: string, ): Promise { const response = await axios.get( - `https://api.github.com/repos/${repository}/releases/latest` + `https://api.github.com/repos/${repository}/releases/latest`, ); const release = response.data; const downloadUrl = diff --git a/src/languageServerController.ts b/src/languageServerController.ts index 7494b19..7341da8 100644 --- a/src/languageServerController.ts +++ b/src/languageServerController.ts @@ -70,7 +70,7 @@ export default class LanguageServerController { "samtLanguageServer", "SAMT Language Server", serverOptions, - clientOptions + clientOptions, ); await this.client.start(); @@ -123,7 +123,7 @@ export default class LanguageServerController { try { const releaseAsset = await getLatestReleaseAsset( githubRepository, - jarName + jarName, ); if (currentFile != null && currentReleaseId === releaseAsset.releaseId) { @@ -142,15 +142,15 @@ export default class LanguageServerController { const file = await fileDownloader.downloadFile( vscode.Uri.parse(releaseAsset.downloadUrl), jarName, - this.context + this.context, ); await this.context.globalState.update( releaseIdKey, - releaseAsset.releaseId + releaseAsset.releaseId, ); this.wasDownloaded = true; return file.fsPath; - } + }, ); } catch (e) { console.error(e); diff --git a/src/samtTaskProvider.ts b/src/samtTaskProvider.ts index b303b2e..8c44e1b 100644 --- a/src/samtTaskProvider.ts +++ b/src/samtTaskProvider.ts @@ -13,7 +13,7 @@ export default class SamtTaskProvider implements vscode.TaskProvider { this.fileWatcher = vscode.workspace.createFileSystemWatcher( `**/${scriptName}}`, false, - true // ignore change events + true, // ignore change events ); const fileListener = () => { this.tasksPromise = null; @@ -37,7 +37,7 @@ export default class SamtTaskProvider implements vscode.TaskProvider { task.scope ?? vscode.TaskScope.Workspace, task.name, task.source, - getShellExecution(definition) + getShellExecution(definition), ); } @@ -57,7 +57,7 @@ interface SamtTaskDefinition extends vscode.TaskDefinition { } async function getSamtTasks( - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { const wrappers = await findSamtWrappersWithConfig(token); return wrappers.map((wrapper) => { @@ -80,7 +80,7 @@ async function getSamtTasks( folder ?? vscode.TaskScope.Workspace, "compile", "samt", - getShellExecution(definition) + getShellExecution(definition), ); task.group = vscode.TaskGroup.Build; return task; @@ -88,13 +88,13 @@ async function getSamtTasks( } async function findSamtWrappersWithConfig( - token: vscode.CancellationToken + token: vscode.CancellationToken, ): Promise { const wrappers = await vscode.workspace.findFiles( `**/${scriptName}`, undefined, undefined, - token + token, ); const wrappersWithConfig: vscode.Uri[] = []; for (const wrapper of wrappers) { @@ -111,13 +111,13 @@ async function hasConfig(wrapperPath: string) { } function getShellExecution( - definition: SamtTaskDefinition + definition: SamtTaskDefinition, ): vscode.ShellExecution { return new vscode.ShellExecution( `./${scriptName}`, [definition.command, ...definition.args], { cwd: definition.cwd, - } + }, ); } diff --git a/src/test/suite/grammar.test.ts b/src/test/suite/grammar.test.ts index 71a1776..a11ea7c 100644 --- a/src/test/suite/grammar.test.ts +++ b/src/test/suite/grammar.test.ts @@ -10,7 +10,7 @@ import path from "path"; async function readGrammar(): Promise { const grammarPath = path.resolve( __dirname, - "../../../syntaxes/samt.tmLanguage.json" + "../../../syntaxes/samt.tmLanguage.json", ); const grammarJson = await readFile(grammarPath, "utf8"); return Convert.toTextmateGrammar(grammarJson); @@ -46,7 +46,7 @@ suite("TextMate Grammar Test Suite", () => { } assert( pattern.patterns?.some((p) => p.include === "#code"), - `code was not included in pattern ${JSON.stringify(pattern)}` + `code was not included in pattern ${JSON.stringify(pattern)}`, ); pattern.patterns?.forEach(checkPatternRecursive); } @@ -72,7 +72,7 @@ suite("TextMate Grammar Test Suite", () => { }: Pattern) { assert( name == null || name.endsWith(".samt"), - `scope name "${name ?? ""}" does not end with .samt` + `scope name "${name ?? ""}" does not end with .samt`, ); patterns?.forEach(checkPatternRecursive); for (const c of [captures, beginCaptures, endCaptures, whileCaptures]) { @@ -140,7 +140,7 @@ suite("TextMate Grammar Test Suite", () => { function checkRegex(regexString: string): void { const includedKeywords = keywords.filter((keyword) => - new RegExp(`\\b${keyword}\\b`).test(regexString) + new RegExp(`\\b${keyword}\\b`).test(regexString), ); if (includedKeywords.length === 0) { return;