11import { workspace , ExtensionContext , Disposable } from "vscode" ;
22import { LanguageClient , LanguageClientOptions , ServerOptions } from "vscode-languageclient" ;
3+ import { absolutePath } from "../helpers/AbsolutePath" ;
34import * as config from "./config-helpers" ;
45import { 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