diff --git a/package.json b/package.json index f0dcc1e..1a57b05 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "vscode-erg", "description": "Erg language support for Visual Studio Code", "publisher": "erg-lang", - "version": "0.1.9", + "version": "0.1.10", "engines": { "vscode": "^1.70.0" }, @@ -61,10 +61,20 @@ "default": "", "description": "Path to `erg` executable" }, - "vscode-erg.lsp.inlayhints": { + "vscode-erg.lsp.inlayHints": { "type": "boolean", "default": true, "description": "Enable inlay hints" + }, + "vscode-erg.lsp.semanticTokens": { + "type": "boolean", + "default": true, + "description": "Enable semantic tokens" + }, + "vscode-erg.lsp.hover": { + "type": "boolean", + "default": true, + "description": "Enable hover" } } } diff --git a/src/extension.ts b/src/extension.ts index 14dee84..33293a1 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -16,6 +16,9 @@ async function startLanguageClient(context: ExtensionContext) { .get("executablePath", ""); return executablePath === "" ? "erg" : executablePath; })(); + const enableInlayHints = workspace.getConfiguration("vscode-erg").get("lsp.inlayHints", true); + const enableSemanticTokens = workspace.getConfiguration("vscode-erg").get("lsp.semanticTokens", true); + const enableHover = workspace.getConfiguration("vscode-erg").get("lsp.hover", true); const buildFeatures = await (async () => { const buildFeaturesProcess = spawn(executablePath, ["--build-features"]); let buildFeatures = ""; @@ -25,10 +28,26 @@ async function startLanguageClient(context: ExtensionContext) { return buildFeatures; })(); let serverOptions: ServerOptions; + let args = ["--language-server"]; + if (!(enableInlayHints && enableSemanticTokens && enableHover)) { + args.push("--"); + } + if (!enableInlayHints) { + args.push("--disable"); + args.push("inlayHints"); + } + if (!enableSemanticTokens) { + args.push("--disable"); + args.push("semanticTokens"); + } + if (!enableHover) { + args.push("--disable"); + args.push("hover"); + } if (buildFeatures.includes("els")) { serverOptions = { command: executablePath, - args: ["--language-server"], + args, }; } else { serverOptions = {