Skip to content

Commit c4ae6b4

Browse files
hasufellfendor
authored andcommitted
Allow to overwrite metadata url
1 parent 978e07d commit c4ae6b4

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ or set `haskell.serverExecutablePath` to a valid executable.
9191

9292
You can also tell HLS to use your system provided ghcup by setting `haskell.useSystemGHCup` to `true` (default is `false`).
9393

94+
If you need to set mirrors for ghcup download info, check the settings `haskell.metadataURL` and `haskell.releasesURL`.
95+
9496
### Supported GHC versions
9597

9698
These are the versions of GHC that there are binaries of `haskell-language-server-1.6.1` for. Building from source may support more versions!

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,13 @@
125125
"scope": "resource",
126126
"type": "string",
127127
"default": "",
128-
"description": "An optional URL to override where to check for haskell-language-server releases"
128+
"description": "An optional URL to override where ghcup checks for HLS-GHC compatibilty list (usually at: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/hls-metadata-0.0.1.json)"
129+
},
130+
"haskell.metadataURL": {
131+
"scope": "resource",
132+
"type": "string",
133+
"default": "",
134+
"description": "An optional URL to override where ghcup checks for tool download info (usually at: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml)"
129135
},
130136
"haskell.releasesDownloadStoragePath": {
131137
"scope": "resource",

src/hlsBinaries.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,14 @@ async function callGHCup(
279279
) => void
280280
): Promise<string> {
281281

282+
const metadataUrl = workspace.getConfiguration('haskell').metadataURL;
283+
282284
const storagePath: string = await getStoragePath(context);
283285
const ghcup = (systemGHCup === true) ? `ghcup${exeExt}` : path.join(storagePath, `ghcup${exeExt}`);
284286
if (systemGHCup) {
285-
return await callAsync('ghcup', ['--no-verbose'].concat(args), storagePath, logger, title, cancellable, undefined, callback);
287+
return await callAsync('ghcup', ['--no-verbose'].concat(metadataUrl ? ['-s', metadataUrl] : []).concat(args), storagePath, logger, title, cancellable, undefined, callback);
286288
} else {
287-
return await callAsync(ghcup, ['--no-verbose'].concat(args), storagePath, logger, title, cancellable, {
289+
return await callAsync(ghcup, ['--no-verbose'].concat(metadataUrl ? ['-s', metadataUrl] : []).concat(args), storagePath, logger, title, cancellable, {
288290
GHCUP_INSTALL_BASE_PREFIX: storagePath,
289291
}, callback);
290292
}

0 commit comments

Comments
 (0)