Skip to content

Commit 05159e3

Browse files
authored
Merge pull request #533 from hasufell/update-hls-installation
Update HLS installation method
2 parents cfcb3b5 + 5249d21 commit 05159e3

File tree

10 files changed

+5506
-939
lines changed

10 files changed

+5506
-939
lines changed

.github/workflows/test.yml

+40-6
Original file line numberDiff line numberDiff line change
@@ -11,35 +11,69 @@ jobs:
1111
strategy:
1212
matrix:
1313
os: [macos-11, ubuntu-latest, windows-latest]
14-
ghc: [9.0.1]
15-
include:
16-
# To test a ghc version deprecated in newer hls versions
17-
- os: ubuntu-latest
18-
ghc: 8.10.4
14+
ghc: [9.0.1, 8.10.4]
1915
runs-on: ${{ matrix.os }}
2016
steps:
2117
- name: Checkout
2218
uses: actions/checkout@v2
2319
- name: Install Node.js
2420
uses: actions/setup-node@v1
2521
with:
26-
node-version: 14
22+
node-version: 17
23+
# Setup the environment for the tests
2724
- name: Ensure there is a supported ghc versions
2825
uses: haskell/actions/setup@v1
2926
with:
3027
ghc-version: ${{ matrix.ghc }}
28+
run: xvfb-run -s '-screen 0 640x480x16' -a npm test
29+
- name: "Install `tree` for MacOs"
30+
run: |
31+
brew update
32+
brew install tree
33+
if: runner.os == 'macOS'
34+
- name: "Install `tree` for Windows"
35+
run: |
36+
choco install tree
37+
if: runner.os == 'Windows'
38+
# Pre-fetch HLS binaries before the tests because otherwise
39+
# we run into timeouts. Downloading takes longer, since we download
40+
# per HLS version one HLS binary per GHC version.
41+
- run: |
42+
mkdir -p test-workspace/bin/
43+
export GHCUP_INSTALL_BASE_PREFIX=$(pwd)/test-workspace/bin
44+
echo $XDG_BIN_HOME $GHCUP_INSTALL_BASE_PREFIX
45+
ghcup config set cache true
46+
ghcup --no-verbose prefetch hls 1.4.0
47+
ghcup --no-verbose prefetch hls latest
48+
shell: bash
49+
50+
# Install test dependencies
3151
- run: npm ci
3252
- run: npm run webpack
53+
54+
# Run the tests
3355
- run: xvfb-run -s '-screen 0 640x480x16' -a npm test
3456
if: runner.os == 'Linux'
3557
- run: npm test
3658
if: runner.os != 'Linux'
59+
60+
# Upload test artefacts
3761
- name: Upload log file to workflow artifacts on error
3862
if: failure()
3963
uses: actions/upload-artifact@v2
4064
with:
4165
name: extension-${{ matrix.os }}.log
4266
path: test-workspace/hls.log
67+
68+
# Create package artefacts
69+
- name: Delete test artefacts
70+
# The test-suite doesn't clean up correctly after itself.
71+
# This is a poor man's workaround that after test execution,
72+
# the test-workspace still contains binaries and caches.
73+
run: |
74+
tree -a test-workspace/
75+
rm -rf test-workspace/
76+
shell: bash
4377
- name: Package tested extension
4478
if: runner.os == 'Linux'
4579
run: npx vsce package

README.md

+13-7
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,27 @@ The environment _only will be visible for the lsp server_, not for other extensi
7171

7272
### Downloaded binaries
7373

74-
This extension will download `haskell-language-server` binaries to a specific location depending on your system.
74+
This extension will download `haskell-language-server` binaries via an (internal) ghcup to a specific location depending
75+
on your system, unless you set the config option `haskell.manageHLS` to `false` (the default is `true`).
7576

7677
It will download the newest version of haskell-language-server which has support for the required ghc.
7778
That means it could use an older version than the latest one, without the last features and bug fixes.
7879
For example, if a project needs ghc-8.10.4 the extension will download and use haskell-language-server-1.4.0, the lastest version which supported ghc-8.10.4. Even if the lastest global haskell language-server version is 1.5.1.
7980

8081
If you find yourself running out of disk space, you can try deleting old versions of language servers in this directory. The extension will redownload them, no strings attached.
8182

82-
| Platform | Path |
83-
| -------- | ------------------------------------------------------------------------- |
84-
| macOS | `~/Library/Application\ Support/Code/User/globalStorage/haskell.haskell/` |
85-
| Windows | `%APPDATA%\Code\User\globalStorage\haskell.haskell` |
86-
| Linux | `$HOME/.config/Code/User/globalStorage/haskell.haskell` |
83+
| Platform | Path |
84+
| -------- | ------------------------------------------------------------------------------- |
85+
| macOS | `~/Library/Application\ Support/Code/User/globalStorage/haskell.haskell/.ghcup` |
86+
| Windows | `%APPDATA%\Code\User\globalStorage\haskell.haskell\ghcup` |
87+
| Linux | `$HOME/.config/Code/User/globalStorage/haskell.haskell/.ghcup` |
8788

88-
Note that if `haskell-language-server-wrapper`/`haskell-language-server` is already on the PATH or you have set the `haskell.serverExecutablePath` option, then the extension will launch it directly instead of downloading binaries, even if the version of the former is older then the latter.
89+
If you want to manage HLS yourself, set `haskell.manageHLS` to `false` and make sure HLS is in your PATH
90+
or set `haskell.serverExecutablePath` to a valid executable.
91+
92+
You can also tell HLS to use your system provided ghcup by setting `haskell.useSystemGHCup` to `true` (default is `false`).
93+
94+
If you need to set mirrors for ghcup download info, check the settings `haskell.metadataURL` and `haskell.releasesURL`.
8995

9096
### Supported GHC versions
9197

0 commit comments

Comments
 (0)