Skip to content

Commit 3f16749

Browse files
Pass environment variables to the language server
1 parent 2bfde49 commit 3f16749

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/extension.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,6 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold
208208
args = args.concat(extraArgs.split(' '));
209209
}
210210

211-
const envVars: IEnvVars = workspace.getConfiguration('haskell', uri).envVars;
212-
for (const [key, val] of Object.entries(envVars)) {
213-
process.env[key] = val;
214-
}
215-
216211
// If we're operating on a standalone file (i.e. not in a folder) then we need
217212
// to launch the server in a reasonable current directory. Otherwise the cradle
218213
// guessing logic in hie-bios will be wrong!
@@ -222,8 +217,10 @@ async function activateServerForFolder(context: ExtensionContext, uri: Uri, fold
222217
logger.info(`Activating the language server in the parent dir of the file: ${uri.fsPath}`);
223218
}
224219

220+
const envVars: IEnvVars = workspace.getConfiguration('haskell', uri).envVars;
225221
const exeOptions: ExecutableOptions = {
226222
cwd: folder ? undefined : path.dirname(uri.fsPath),
223+
env: Object.assign(process.env, envVars),
227224
};
228225

229226
// We don't want empty strings in our args

0 commit comments

Comments
 (0)