diff --git a/src/hlsBinaries.ts b/src/hlsBinaries.ts index f1ae6990..ee0443c5 100644 --- a/src/hlsBinaries.ts +++ b/src/hlsBinaries.ts @@ -102,7 +102,6 @@ async function callAsync( let newEnv: IEnvVars = await resolveServerEnvironmentPATH(workspace.getConfiguration('haskell').get('serverEnvironment') || {}); newEnv = {...process.env as IEnvVars, ...newEnv}; newEnv = {...newEnv, ...(envAdd || {})}; - logger.info(`newEnv: ${newEnv.PATH!.split(':')}`); return window.withProgress( { location: ProgressLocation.Notification, @@ -255,7 +254,7 @@ export async function findHaskellLanguageServer( ? await getLatestToolFromGHCup(context, logger, 'stack') : null; const recGHC = - !executableExists('ghc') && (workspace.getConfiguration('haskell').get('installGHC') as boolean) + (!(await executableExists('ghc')) && (workspace.getConfiguration('haskell').get('installGHC') as boolean)) ? await getLatestAvailableToolFromGHCup(context, logger, 'ghc', 'recommended') : null; diff --git a/src/utils.ts b/src/utils.ts index 377de51c..b0c876c8 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -333,10 +333,10 @@ export async function addPathToProcessPath(extraPath: string, logger: Logger): P export async function resolveServerEnvironmentPATH(serverEnv: IEnvVars): Promise { const pathSep = process.platform === 'win32' ? ';' : ':'; - const path: string[] = serverEnv.PATH.split(pathSep).map((p) => resolvePATHPlaceHolders(p)); + const path: string[] | null = serverEnv.PATH ? serverEnv.PATH.split(pathSep).map((p) => resolvePATHPlaceHolders(p)) : null; return { ...serverEnv, - ...{ PATH: path.join(pathSep)} + ...(path ? { PATH: path.join(pathSep)} : {}) } }