Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update HLS installation method #533

Merged
merged 52 commits into from
Mar 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
f835832
Update HLS installation method
hasufell Feb 28, 2022
376ddd9
Fix PATH handling
hasufell Feb 28, 2022
11b2e0c
Improve callAsync wrt title/cancellable
hasufell Feb 28, 2022
3a01f18
Set GHCUP_INSTALL_BASE_PREFIX when running ghcup
hasufell Feb 28, 2022
abcd4a8
Fix whitespaces in error messages
hasufell Feb 28, 2022
bbf82e2
Properly validate hls executables wrt ghc version
hasufell Feb 28, 2022
0b39676
Simplify ghcup handling
hasufell Feb 28, 2022
45d77dd
Preserve behavior of installing outdated HLS if needed
hasufell Feb 28, 2022
b9163bb
Fix test suite
hasufell Feb 28, 2022
478a6ba
Prefetch HLS
hasufell Mar 1, 2022
a44cddf
Set up the environment in the test-suite
fendor Mar 2, 2022
1fc0d57
Add check for ghcup
fendor Mar 2, 2022
76941b1
Don't delete the cache directory of ghcup
fendor Mar 2, 2022
5785c88
Fix installation on windows
hasufell Mar 2, 2022
01f8fd5
Force 64bit for windows test
hasufell Mar 2, 2022
5274807
Fix ghcup dir on windows
hasufell Mar 2, 2022
a0304dd
WTF
hasufell Mar 2, 2022
e500d4c
Update package-lock.json
fendor Mar 3, 2022
a9a77e0
Update test regex
fendor Mar 3, 2022
4f6a513
Re-design `deleteFiles`
fendor Mar 3, 2022
16a52be
Fix keepDirs check during deletion
fendor Mar 3, 2022
079b5e5
API is slightly weird, delete empty dirs recursively
fendor Mar 3, 2022
51441ba
Improve test-logging
fendor Mar 3, 2022
8caff42
Change regex matcher again
fendor Mar 3, 2022
6ff82fe
Debug windows CI
fendor Mar 3, 2022
127e77f
Try different globbing
fendor Mar 3, 2022
c89da69
Increase every timeout to 90
fendor Mar 4, 2022
db82190
Remove test artefacts in CI
fendor Mar 4, 2022
a8613c5
Install `tree` for macos, too
fendor Mar 4, 2022
c4b0e06
Install `tree` for windows, too
fendor Mar 4, 2022
6ddb943
Run `npm audit fix`
fendor Mar 4, 2022
0777376
Bump node version in CI
fendor Mar 4, 2022
a5824a2
Update even more packages
fendor Mar 4, 2022
a74e092
Let the linter work
fendor Mar 5, 2022
2daf8c2
Improve documentation
fendor Mar 5, 2022
b422ffc
Document CI hacks slightly better
fendor Mar 5, 2022
09bc59c
Update release metadata url
fendor Mar 9, 2022
68451d3
Delete unused code in the tests
fendor Mar 9, 2022
cafcc80
Factor out callGHCup
hasufell Mar 9, 2022
bd87282
Enable caching for tests
hasufell Mar 9, 2022
f996155
Allow to use system ghcup
hasufell Mar 9, 2022
af0ed98
Simplify configuration/updates
hasufell Mar 9, 2022
10bf377
Reduce extension log delay
hasufell Mar 10, 2022
3397b1a
Prompt user if they want to use system ghcup or not
hasufell Mar 11, 2022
7a4c578
Fix bugs, improve popups and other stuff
hasufell Mar 11, 2022
978e07d
Update README
hasufell Mar 11, 2022
c4ae6b4
Allow to overwrite metadata url
hasufell Mar 11, 2022
91d68a4
Retry promise in CI test
hasufell Mar 11, 2022
d536aca
Apply `npm run tslint-fix`
fendor Mar 12, 2022
e9d3efa
Clarify some documentation
fendor Mar 12, 2022
82ae4c1
Show error message if GHC version is not supported
fendor Mar 12, 2022
5249d21
Test fallback mechanism on all platforms
fendor Mar 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 40 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,69 @@ jobs:
strategy:
matrix:
os: [macos-11, ubuntu-latest, windows-latest]
ghc: [9.0.1]
include:
# To test a ghc version deprecated in newer hls versions
- os: ubuntu-latest
ghc: 8.10.4
ghc: [9.0.1, 8.10.4]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v1
with:
node-version: 14
node-version: 17
# Setup the environment for the tests
- name: Ensure there is a supported ghc versions
uses: haskell/actions/setup@v1
with:
ghc-version: ${{ matrix.ghc }}
run: xvfb-run -s '-screen 0 640x480x16' -a npm test
- name: "Install `tree` for MacOs"
run: |
brew update
brew install tree
if: runner.os == 'macOS'
- name: "Install `tree` for Windows"
run: |
choco install tree
if: runner.os == 'Windows'
# Pre-fetch HLS binaries before the tests because otherwise
# we run into timeouts. Downloading takes longer, since we download
# per HLS version one HLS binary per GHC version.
- run: |
mkdir -p test-workspace/bin/
export GHCUP_INSTALL_BASE_PREFIX=$(pwd)/test-workspace/bin
echo $XDG_BIN_HOME $GHCUP_INSTALL_BASE_PREFIX
ghcup config set cache true
ghcup --no-verbose prefetch hls 1.4.0
ghcup --no-verbose prefetch hls latest
shell: bash

# Install test dependencies
- run: npm ci
- run: npm run webpack

# Run the tests
- run: xvfb-run -s '-screen 0 640x480x16' -a npm test
if: runner.os == 'Linux'
- run: npm test
if: runner.os != 'Linux'

# Upload test artefacts
- name: Upload log file to workflow artifacts on error
if: failure()
uses: actions/upload-artifact@v2
with:
name: extension-${{ matrix.os }}.log
path: test-workspace/hls.log

# Create package artefacts
- name: Delete test artefacts
# The test-suite doesn't clean up correctly after itself.
# This is a poor man's workaround that after test execution,
# the test-workspace still contains binaries and caches.
run: |
tree -a test-workspace/
rm -rf test-workspace/
shell: bash
- name: Package tested extension
if: runner.os == 'Linux'
run: npx vsce package
Expand Down
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,27 @@ The environment _only will be visible for the lsp server_, not for other extensi

### Downloaded binaries

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

It will download the newest version of haskell-language-server which has support for the required ghc.
That means it could use an older version than the latest one, without the last features and bug fixes.
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.

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.

| Platform | Path |
| -------- | ------------------------------------------------------------------------- |
| macOS | `~/Library/Application\ Support/Code/User/globalStorage/haskell.haskell/` |
| Windows | `%APPDATA%\Code\User\globalStorage\haskell.haskell` |
| Linux | `$HOME/.config/Code/User/globalStorage/haskell.haskell` |
| Platform | Path |
| -------- | ------------------------------------------------------------------------------- |
| macOS | `~/Library/Application\ Support/Code/User/globalStorage/haskell.haskell/.ghcup` |
| Windows | `%APPDATA%\Code\User\globalStorage\haskell.haskell\ghcup` |
| Linux | `$HOME/.config/Code/User/globalStorage/haskell.haskell/.ghcup` |

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.
If you want to manage HLS yourself, set `haskell.manageHLS` to `false` and make sure HLS is in your PATH
or set `haskell.serverExecutablePath` to a valid executable.

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

If you need to set mirrors for ghcup download info, check the settings `haskell.metadataURL` and `haskell.releasesURL`.

### Supported GHC versions

Expand Down
Loading