From 86f2fd84dbf944a2bb35b17bffb1a803b4619440 Mon Sep 17 00:00:00 2001 From: Valentin Knabel Date: Sat, 7 Mar 2020 12:18:11 +0100 Subject: [PATCH] sourcekit-lsp with different toolchains failed #63 --- CHANGELOG.md | 3 ++- package.json | 2 +- src/clientMain.ts | 29 ++++++++++++++++++++--------- tsconfig.json | 24 ++++++++++++------------ 4 files changed, 35 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 078bc4a..d37e6ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,8 @@ # Changelog -## Master +## 2.9.0 +- `sourcekit-lsp` with different toolchains failed #63 - Drop broken debugger of SDE #22 If you are curious about how to set debugging up, see [Debugging Swift in VS Code](https://www.vknabel.com/pages/Debugging-Swift-in-VS-Code/). diff --git a/package.json b/package.json index 0d87bec..19a14db 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "url": "https://github.com/vknabel" }, "license": "Apache-2.0", - "version": "2.8.3", + "version": "2.9.0", "publisher": "vknabel", "icon": "icons/icon.png", "galleryBanner": { diff --git a/src/clientMain.ts b/src/clientMain.ts index 1190c6e..c00f185 100644 --- a/src/clientMain.ts +++ b/src/clientMain.ts @@ -100,16 +100,12 @@ function currentServerOptions(context: ExtensionContext) { const toolchain = workspace .getConfiguration("sourcekit-lsp") .get("toolchainPath"); - const env = toolchain - ? { env: { ...process.env, SOURCEKIT_TOOLCHAIN_PATH: toolchain } } - : { env: process.env }; + const env: NodeJS.ProcessEnv = toolchain + ? { ...process.env, SOURCEKIT_TOOLCHAIN_PATH: toolchain } + : process.env; const run: Executable = { command: executableCommand, options: { env } }; - const debug: Executable = run; - const serverOptions: ServerOptions = { - run: run, - debug: debug - }; + const serverOptions: ServerOptions = run; return serverOptions; } @@ -123,6 +119,20 @@ function currentServerOptions(context: ExtensionContext) { } } +function currentClientOptions( + _context: ExtensionContext +): Partial { + const lspMode = workspace.getConfiguration("sde").get("languageServerMode"); + if (lspMode === "sourcekit-lsp") { + return { + documentSelector: ["swift", "cpp", "c", "objective-c", "objective-cpp"], + synchronize: undefined + }; + } else { + return {}; + } +} + export function activate(context: ExtensionContext) { if (workspace.getConfiguration().get("sde.enable") === false) { return; @@ -155,7 +165,8 @@ export function activate(context: ExtensionContext) { workspace .getConfiguration("sourcekit-lsp") .get("toolchainPath") || null - } + }, + ...currentClientOptions(context) }; // Create the language client and start the client. diff --git a/tsconfig.json b/tsconfig.json index 321ff88..ef93279 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,12 +1,12 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "outDir": "out", - "lib": ["es6"], - "sourceMap": true, - "rootDir": "." - }, - "exclude": ["node_modules", "server", "out"], - "compileOnSave": true -} +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "outDir": "out", + "lib": ["es6"], + "sourceMap": true, + "rootDir": "." + }, + "exclude": ["node_modules", "server", "out"], + "compileOnSave": true +}