@@ -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+
126136export 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.
0 commit comments