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

Commit 86f2fd8

Browse files
committed
sourcekit-lsp with different toolchains failed #63
1 parent bc79c8d commit 86f2fd8

File tree

4 files changed

+35
-23
lines changed

4 files changed

+35
-23
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Changelog
22

3-
## Master
3+
## 2.9.0
44

5+
- `sourcekit-lsp` with different toolchains failed #63
56
- Drop broken debugger of SDE #22
67

78
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/).

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"url": "https://github.com/vknabel"
99
},
1010
"license": "Apache-2.0",
11-
"version": "2.8.3",
11+
"version": "2.9.0",
1212
"publisher": "vknabel",
1313
"icon": "icons/icon.png",
1414
"galleryBanner": {

src/clientMain.ts

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,12 @@ function currentServerOptions(context: ExtensionContext) {
100100
const toolchain = workspace
101101
.getConfiguration("sourcekit-lsp")
102102
.get<string>("toolchainPath");
103-
const env = toolchain
104-
? { env: { ...process.env, SOURCEKIT_TOOLCHAIN_PATH: toolchain } }
105-
: { env: process.env };
103+
const env: NodeJS.ProcessEnv = toolchain
104+
? { ...process.env, SOURCEKIT_TOOLCHAIN_PATH: toolchain }
105+
: process.env;
106106

107107
const run: Executable = { command: executableCommand, options: { env } };
108-
const debug: Executable = run;
109-
const serverOptions: ServerOptions = {
110-
run: run,
111-
debug: debug
112-
};
108+
const serverOptions: ServerOptions = run;
113109
return serverOptions;
114110
}
115111

@@ -123,6 +119,20 @@ function currentServerOptions(context: ExtensionContext) {
123119
}
124120
}
125121

122+
function currentClientOptions(
123+
_context: ExtensionContext
124+
): Partial<LanguageClientOptions> {
125+
const lspMode = workspace.getConfiguration("sde").get("languageServerMode");
126+
if (lspMode === "sourcekit-lsp") {
127+
return {
128+
documentSelector: ["swift", "cpp", "c", "objective-c", "objective-cpp"],
129+
synchronize: undefined
130+
};
131+
} else {
132+
return {};
133+
}
134+
}
135+
126136
export function activate(context: ExtensionContext) {
127137
if (workspace.getConfiguration().get<boolean>("sde.enable") === false) {
128138
return;
@@ -155,7 +165,8 @@ export function activate(context: ExtensionContext) {
155165
workspace
156166
.getConfiguration("sourcekit-lsp")
157167
.get<string>("toolchainPath") || null
158-
}
168+
},
169+
...currentClientOptions(context)
159170
};
160171

161172
// Create the language client and start the client.

tsconfig.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
{
2-
"compilerOptions": {
3-
"module": "commonjs",
4-
"target": "es6",
5-
"outDir": "out",
6-
"lib": ["es6"],
7-
"sourceMap": true,
8-
"rootDir": "."
9-
},
10-
"exclude": ["node_modules", "server", "out"],
11-
"compileOnSave": true
12-
}
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"target": "es6",
5+
"outDir": "out",
6+
"lib": ["es6"],
7+
"sourceMap": true,
8+
"rootDir": "."
9+
},
10+
"exclude": ["node_modules", "server", "out"],
11+
"compileOnSave": true
12+
}

0 commit comments

Comments
 (0)