Skip to content
This repository has been archived by the owner on Jun 22, 2024. It is now read-only.

Commit

Permalink
sourcekit-lsp with different toolchains failed #63
Browse files Browse the repository at this point in the history
  • Loading branch information
vknabel committed Mar 7, 2020
1 parent bc79c8d commit 86f2fd8
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 23 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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/).
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
29 changes: 20 additions & 9 deletions src/clientMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,12 @@ function currentServerOptions(context: ExtensionContext) {
const toolchain = workspace
.getConfiguration("sourcekit-lsp")
.get<string>("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;
}

Expand All @@ -123,6 +119,20 @@ function currentServerOptions(context: ExtensionContext) {
}
}

function currentClientOptions(
_context: ExtensionContext
): Partial<LanguageClientOptions> {
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<boolean>("sde.enable") === false) {
return;
Expand Down Expand Up @@ -155,7 +165,8 @@ export function activate(context: ExtensionContext) {
workspace
.getConfiguration("sourcekit-lsp")
.get<string>("toolchainPath") || null
}
},
...currentClientOptions(context)
};

// Create the language client and start the client.
Expand Down
24 changes: 12 additions & 12 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 86f2fd8

Please sign in to comment.