Skip to content

Commit e9d3efa

Browse files
committed
Clarify some documentation
1 parent d536aca commit e9d3efa

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/hlsBinaries.ts

+14-4
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ class MissingToolError extends Error {
7373
* @param callback Upon process termination, execute this callback. If given, must resolve promise.
7474
* @returns Stdout of the process invocation, trimmed off newlines, or whatever the `callback` resolved to.
7575
*/
76-
7776
async function callAsync(
7877
binary: string,
7978
args: string[],
@@ -177,14 +176,16 @@ function findHLSinPATH(context: ExtensionContext, logger: Logger, folder?: Works
177176
}
178177

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

313-
// get project GHC version
322+
// get project GHC version, but fallback to system ghc if necessary.
314323
const projectGhc =
315324
wrapper === undefined
316325
? await callAsync(`ghc${exeExt}`, ['--numeric-version'], storagePath, logger, undefined, false)
@@ -350,6 +359,7 @@ export async function getProjectGHCVersion(
350359
if (stdout) {
351360
logger.error(`stdout: ${stdout}`);
352361
}
362+
// Error message emitted by HLS-wrapper
353363
const regex = /Cradle requires (.+) but couldn't find it/;
354364
const res = regex.exec(stderr);
355365
if (res) {

0 commit comments

Comments
 (0)