Skip to content

Commit 123dd09

Browse files
committed
Clarify some documentation
1 parent 07bba8f commit 123dd09

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/hlsBinaries.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ class MissingToolError extends Error {
7575
* @param callback Upon process termination, execute this callback. If given, must resolve promise.
7676
* @returns Stdout of the process invocation, trimmed off newlines, or whatever the `callback` resolved to.
7777
*/
78-
7978
async function callAsync(
8079
binary: string,
8180
args: string[],
@@ -179,14 +178,16 @@ function findHLSinPATH(context: ExtensionContext, logger: Logger, folder?: Works
179178
}
180179

181180
/**
182-
* Downloads the latest haskell-language-server binaries via ghcup.
181+
* Downloads the latest haskell-language-server binaries via GHCup.
182+
* Makes sure that either `ghcup` is available locally, otherwise installs
183+
* it into an isolated location.
183184
* If we figure out the correct GHC version, but it isn't compatible with
184185
* the latest HLS executables, we download the latest compatible HLS binaries
185186
* as a fallback.
186187
*
187188
* @param context Context of the extension, required for metadata.
188189
* @param logger Logger for progress updates.
189-
* @param workingDir Directory in which the process shall be executed.
190+
* @param workingDir Working directory in VSCode.
190191
* @returns Path to haskell-language-server-wrapper
191192
*/
192193
export async function findHaskellLanguageServer(
@@ -310,9 +311,17 @@ async function getLatestSuitableHLS(
310311
undefined,
311312
false,
312313
);
314+
// Output looks like:
315+
// ```
316+
// hls 1.5.1
317+
// hls 1.6.0.0
318+
// hls 1.6.1.0 latest,recommended
319+
// hls 1.6.1.1 stray
320+
// ```
321+
// and we want the `1.6.1.1`
313322
const latestHlsVersion = hlsVersions.split(/\r?\n/).pop()!.split(' ')[1];
314323

315-
// get project GHC version
324+
// get project GHC version, but fallback to system ghc if necessary.
316325
const projectGhc =
317326
wrapper === undefined
318327
? await callAsync(`ghc${exeExt}`, ['--numeric-version'], storagePath, logger, undefined, false)
@@ -352,6 +361,7 @@ export async function getProjectGHCVersion(
352361
if (stdout) {
353362
logger.error(`stdout: ${stdout}`);
354363
}
364+
// Error message emitted by HLS-wrapper
355365
const regex = /Cradle requires (.+) but couldn't find it/;
356366
const res = regex.exec(stderr);
357367
if (res) {

0 commit comments

Comments
 (0)