diff --git a/extension/src/commands.ts b/extension/src/commands.ts index 80b2cd1..5c0e8bb 100644 --- a/extension/src/commands.ts +++ b/extension/src/commands.ts @@ -1,10 +1,6 @@ import { Uri, commands } from "vscode"; // copied and modified from https://github.com/rust-lang/rust-analyzer/blob/27239fbb58a115915ffc1ce65ededc951eb00fd2/editors/code/src/commands.ts -import type { - LanguageClient, - Location, - Position, -} from "vscode-languageclient/node"; +import type { LanguageClient, Location, Position } from "vscode-languageclient/node"; export async function showReferences( client: LanguageClient | undefined, diff --git a/extension/src/extension.ts b/extension/src/extension.ts index aaef40a..60683ee 100644 --- a/extension/src/extension.ts +++ b/extension/src/extension.ts @@ -1,9 +1,5 @@ import { type ExtensionContext, commands, window, workspace } from "vscode"; -import { - LanguageClient, - type LanguageClientOptions, - type ServerOptions, -} from "vscode-languageclient/node"; +import { LanguageClient, type LanguageClientOptions, type ServerOptions } from "vscode-languageclient/node"; import { showReferences } from "./commands"; let client: LanguageClient | undefined; @@ -11,30 +7,16 @@ let client: LanguageClient | undefined; async function startLanguageClient(context: ExtensionContext) { try { const executablePath = (() => { - const executablePath = workspace - .getConfiguration("pylyzer") - .get("executablePath", ""); + const executablePath = workspace.getConfiguration("pylyzer").get("executablePath", ""); return executablePath === "" ? "pylyzer" : executablePath; })(); - const enableDiagnostics = workspace - .getConfiguration("pylyzer") - .get("diagnostics", true); - const enableInlayHints = workspace - .getConfiguration("pylyzer") - .get("inlayHints", false); - const enableSemanticTokens = workspace - .getConfiguration("pylyzer") - .get("semanticTokens", true); - const enableHover = workspace - .getConfiguration("pylyzer") - .get("hover", true); - const smartCompletion = workspace - .getConfiguration("pylyzer") - .get("smartCompletion", true); + const enableDiagnostics = workspace.getConfiguration("pylyzer").get("diagnostics", true); + const enableInlayHints = workspace.getConfiguration("pylyzer").get("inlayHints", false); + const enableSemanticTokens = workspace.getConfiguration("pylyzer").get("semanticTokens", true); + const enableHover = workspace.getConfiguration("pylyzer").get("hover", true); + const smartCompletion = workspace.getConfiguration("pylyzer").get("smartCompletion", true); /* optional features */ - const checkOnType = workspace - .getConfiguration("pylyzer") - .get("checkOnType", false); + const checkOnType = workspace.getConfiguration("pylyzer").get("checkOnType", false); const args = ["--server"]; args.push("--"); if (!enableDiagnostics) { @@ -96,18 +78,11 @@ async function restartLanguageClient() { } export async function activate(context: ExtensionContext) { + context.subscriptions.push(commands.registerCommand("pylyzer.restartLanguageServer", () => restartLanguageClient())); context.subscriptions.push( - commands.registerCommand("pylyzer.restartLanguageServer", () => - restartLanguageClient(), - ), - ); - context.subscriptions.push( - commands.registerCommand( - "pylyzer.showReferences", - async (uri, position, locations) => { - await showReferences(client, uri, position, locations); - }, - ), + commands.registerCommand("pylyzer.showReferences", async (uri, position, locations) => { + await showReferences(client, uri, position, locations); + }), ); await startLanguageClient(context); }