@@ -25,6 +25,11 @@ import { DocsBrowser } from './docsBrowser';
25
25
import { downloadHaskellLanguageServer } from './hlsBinaries' ;
26
26
import { directoryExists , executableExists , ExtensionLogger , resolvePathPlaceHolders } from './utils' ;
27
27
28
+ // Used for environment variables later on
29
+ interface IEnvVars {
30
+ [ key : string ] : string ;
31
+ }
32
+
28
33
// The current map of documents & folders to language servers.
29
34
// It may be null to indicate that we are in the process of launching a server,
30
35
// in which case don't try to launch another one for that uri
@@ -218,8 +223,10 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold
218
223
logger . info ( `Activating the language server in the parent dir of the file: ${ uri . fsPath } ` ) ;
219
224
}
220
225
226
+ const serverEnvironment : IEnvVars = workspace . getConfiguration ( 'haskell' , uri ) . serverEnvironment ;
221
227
const exeOptions : ExecutableOptions = {
222
228
cwd : folder ? undefined : path . dirname ( uri . fsPath ) ,
229
+ env : Object . assign ( process . env , serverEnvironment ) ,
223
230
} ;
224
231
225
232
// We don't want empty strings in our args
@@ -237,6 +244,12 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold
237
244
if ( exeOptions . cwd ) {
238
245
logger . info ( `server cwd: ${ exeOptions . cwd } ` ) ;
239
246
}
247
+ if ( serverEnvironment ) {
248
+ logger . info ( 'server environment variables:' ) ;
249
+ Object . entries ( serverEnvironment ) . forEach ( ( [ key , val ] : [ string , string | undefined ] ) => {
250
+ logger . info ( ` ${ key } =${ val } ` ) ;
251
+ } ) ;
252
+ }
240
253
241
254
const pat = folder ? `${ folder . uri . fsPath } /**/*` : '**/*' ;
242
255
logger . info ( `document selector patten: ${ pat } ` ) ;
0 commit comments