@@ -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
@@ -212,8 +217,10 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold
212
217
logger . info ( `Activating the language server in the parent dir of the file: ${ uri . fsPath } ` ) ;
213
218
}
214
219
220
+ const serverEnvironment : IEnvVars = workspace . getConfiguration ( 'haskell' , uri ) . serverEnvironment ;
215
221
const exeOptions : ExecutableOptions = {
216
222
cwd : folder ? undefined : path . dirname ( uri . fsPath ) ,
223
+ env : Object . assign ( process . env , serverEnvironment ) ,
217
224
} ;
218
225
219
226
// We don't want empty strings in our args
@@ -231,6 +238,12 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold
231
238
if ( exeOptions . cwd ) {
232
239
logger . info ( `server cwd: ${ exeOptions . cwd } ` ) ;
233
240
}
241
+ if ( serverEnvironment ) {
242
+ logger . info ( 'server environment variables:' ) ;
243
+ Object . entries ( serverEnvironment ) . forEach ( ( [ key , val ] : [ string , string | undefined ] ) => {
244
+ logger . info ( ` ${ key } =${ val } ` ) ;
245
+ } ) ;
246
+ }
234
247
235
248
const pat = folder ? `${ folder . uri . fsPath } /**/*` : '**/*' ;
236
249
logger . info ( `document selector patten: ${ pat } ` ) ;
0 commit comments