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

Commit 2062e36

Browse files
committed
Clean up LSP options
1 parent b83f0d9 commit 2062e36

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

src/vscode/lsp-interop.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { workspace, ExtensionContext, Disposable } from "vscode";
22
import { LanguageClient, LanguageClientOptions, ServerOptions } from "vscode-languageclient";
3+
import { absolutePath } from "../helpers/AbsolutePath";
34
import * as config from "./config-helpers";
45
import { LangaugeServerMode } from "./config-helpers";
56

@@ -21,6 +22,21 @@ function currentClientOptions(): Partial<LanguageClientOptions> {
2122
documentSelector: ["swift", "cpp", "c", "objective-c", "objective-cpp"],
2223
synchronize: undefined,
2324
};
25+
case LangaugeServerMode.SourceKite:
26+
return {
27+
initializationOptions: {
28+
isLSPServerTracingOn: config.isLSPTracingOn(),
29+
skProtocolProcess: absolutePath(
30+
workspace.getConfiguration().get("swift.path.sourcekite")
31+
),
32+
skProtocolProcessAsShellCmd: workspace
33+
.getConfiguration()
34+
.get<boolean>("swift.path.sourcekiteDockerMode"),
35+
skCompilerOptions: workspace.getConfiguration().get("sde.sourcekit.compilerOptions"),
36+
toolchainPath:
37+
workspace.getConfiguration("sourcekit-lsp").get<string>("toolchainPath") || null,
38+
},
39+
};
2440
default:
2541
return {};
2642
}
@@ -49,14 +65,6 @@ function startLSPClient(context: ExtensionContext) {
4965
workspace.createFileSystemWatcher(".build/*.yaml"),
5066
],
5167
},
52-
initializationOptions: {
53-
// isLSPServerTracingOn: config.isLSPTracingOn(), // used by sourcekite
54-
// skProtocolProcess, // used by sourcekite
55-
// skProtocolProcessAsShellCmd, // used by sourcekite
56-
// skCompilerOptions: workspace.getConfiguration().get("sde.sourcekit.compilerOptions"), // used by sourcekite
57-
// toolchainPath:
58-
// workspace.getConfiguration("sourcekit-lsp").get<string>("toolchainPath") || null,
59-
},
6068
...currentClientOptions(),
6169
};
6270
// Create the language client and start the client.

0 commit comments

Comments
 (0)