Skip to content

Commit 293704f

Browse files
Improve troubleshooting and installation docs a bit (#3004)
* Add material about using versions of GHC that aren't supported yet * Add a note about clearing out the build cache * Add note about cabal update to ghcup instructions * Minor improvements to installing doc * Tweak ghcup docs more * Minor fixes Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent a32db0b commit 293704f

File tree

3 files changed

+104
-70
lines changed

3 files changed

+104
-70
lines changed

docs/installation.md

+39-38
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
# Installation
22

3-
A typical haskell-language-server installation consists of:
4-
5-
- One binary file for each supported ghc version: `haskell-language-server-${ghcVersion}`
6-
- Another binary named `haskell-language-version-wrapper` which analyzes the project or file in the current working dir
7-
and calls the appropiate `haskell-language-server-${ghcVersion}` variant.
8-
- It accepts all executable arguments from the plain `haskell-language-server`
9-
103
## Prerequisites
114

12-
- For standalone `.hs`/`.lhs` files, [ghc](https://www.haskell.org/ghc/) must be installed and on the PATH. The easiest way to install it is with [ghcup](https://www.haskell.org/ghcup/) or [chocolatey](https://community.chocolatey.org/packages/ghc) on Windows.
13-
- For Cabal based projects, both ghc and [cabal-install](https://www.haskell.org/cabal/) must be installed and on the PATH. It can also be installed with [ghcup](https://www.haskell.org/ghcup/) or [chocolatey](https://community.chocolatey.org/packages/cabal) on Windows.
14-
- For Stack based projects, [stack](http://haskellstack.org) must be installed and on the PATH.
5+
- For standalone `.hs`/`.lhs` files, [ghc](https://www.haskell.org/ghc/) must be installed and on the `PATH`. The easiest way to install it is with [ghcup](https://www.haskell.org/ghcup/) or [chocolatey](https://community.chocolatey.org/packages/ghc) on Windows.
6+
- For Cabal based projects, both ghc and [cabal-install](https://www.haskell.org/cabal/) must be installed and on the `PATH`. It can also be installed with [ghcup](https://www.haskell.org/ghcup/) or [chocolatey](https://community.chocolatey.org/packages/cabal) on Windows.
7+
- For Stack based projects, [stack](http://haskellstack.org) must be installed and on the `PATH`.
158

169
## ghcup
1710

@@ -21,45 +14,52 @@ If you are using [`ghcup`](https://www.haskell.org/ghcup/) to manage your instal
2114
ghcup install hls
2215
```
2316

24-
You can check if HLS is available for your platorm via ghcup here: <https://haskell.org/ghcup/install/#supported-platforms>.
17+
You can check if HLS is available for your platform via `ghcup` here: <https://haskell.org/ghcup/install/#supported-platforms>.
2518

2619
You can also install HLS from source without checking out the code manually:
2720

2821
```bash
29-
ghcup compile hls -v 1.6.1.0 --ghc 8.10.7
22+
# `ghcup compile` uses cabal under the hood to build, so you may
23+
# want to run `cabal update` beforehand
24+
cabal update
25+
ghcup compile hls -v $HLS_VERSION --ghc $GHC_VERSION
3026
```
3127

32-
Install HLS for multiple GHC versions:
33-
```
34-
ghcup compile hls -v 1.6.1.0 --ghc 8.10.7 --ghc 8.8.4
28+
Make sure to check `ghcup compile hls --help` for more complete help.
29+
30+
Examples:
31+
32+
Install HLS 1.7.0.0 for GHC 8.10.7, or for multiple GHC versions:
33+
```bash
34+
ghcup compile hls -v 1.7.0.0 --ghc 8.10.7
35+
ghcup compile hls -v 1.7.0.0 --ghc 8.10.7 --ghc 9.2.3
3536
```
3637

37-
Use a different `cabal.project` for a GHC version:
38+
Install HLS from master, or a specific commit:
3839
```
39-
ghcup compile hls -v 1.6.1.0 --ghc 9.2.1 --cabal-project cabal.project
40+
ghcup compile hls -g master --ghc 9.2.3
41+
ghcup compile hls -g 510bd51e46fea8fb51ddfaa60bba505f0663497d --ghc 9.2.3
4042
```
4143

42-
Check `ghcup compile hls --help` for a full list of compilation options.
43-
4444
## Installation from source
4545

46-
Direct installation from Source, while possible via `cabal install haskell-language-server`
46+
Direct installation from source, while possible via `cabal install haskell-language-server`
4747
and `stack install --stack-yaml stack-<GHCVER>.yaml`, is not recommended for most people.
48-
Said command builds the `haskell-language-server` binary and installs it in the default Cabal binaries folder,
48+
Said command builds the `haskell-language-server` binary and installs it in the default `cabal` binaries folder,
4949
but the binary will only work with projects that use the same GHC version that built it.
5050

5151
### Common pre-requirements
5252

53-
- `stack` or `cabal` must be in your PATH
54-
- You need stack version >= 2.1.1 or cabal >= 2.4.0.0
55-
- `git` must be in your PATH
53+
- `stack` or `cabal` must be in your `PATH`
54+
- You need `stack` version >= 2.1.1 or `cabal` >= 2.4.0.0
55+
- `git` must be in your `PATH`
5656
- The directory where `stack`or `cabal` put the binaries must be in you PATH:
57-
- For stack you can get it with `stack path --local-bin`
58-
- For cabal it is by default `$HOME/.cabal/bin` in linux and `%APPDATA%\cabal\bin` in windows.
57+
- For `stack` you can get it with `stack path --local-bin`
58+
- For `cabal` it is by default `$HOME/.cabal/bin` in Linux and `%APPDATA%\cabal\bin` in windows.
5959

6060
Tip: you can quickly check if some command is in your path by running the command.
6161
If you receive some meaningful output instead of "command not found"-like message
62-
then it means you have the command in PATH.
62+
then it means you have the command in `PATH`.
6363

6464
### Linux-specific pre-requirements
6565

@@ -87,15 +87,6 @@ sudo apt install libicu-dev libncurses-dev libgmp-dev zlib1g-dev
8787
sudo dnf install libicu-devel ncurses-devel zlib-devel
8888
```
8989

90-
**Gentoo**
91-
92-
Haskell Language Server is available via the Haskell overlay. Follow the instructions [here](https://github.com/gentoo-haskell/gentoo-haskell) to install the overlay, then run:
93-
94-
```bash
95-
emerge -av dev-util/haskell-language-server
96-
```
97-
Depending on your system setup, you may need to enable the unstable flag for this package before install, and possible also for the dependencies. If you enabled the ~testing versions as explained in the gentoo-haskell overlay instructions, then this won't be necessary.
98-
9990
### Windows-specific pre-requirements
10091

10192
In order to avoid problems with long paths on Windows you can do either one of the following:
@@ -120,7 +111,7 @@ If you are using [`chocolatey`](https://chocolatey.org/) to manage your installa
120111

121112
```bash
122113
choco install haskell-language-server
123-
````
114+
```
124115

125116
## Visual Studio Code
126117

@@ -131,7 +122,7 @@ If you need to find the binaries, please consult the [documentation](https://git
131122
## Pre-built binaries
132123

133124
There are pre-built binaries available from the [releases page](https://github.com/haskell/haskell-language-server/releases) for Linux, Windows and macOS.
134-
To install, download the `haskell-language-server-wrapper` executable for your platform as well as any `haskell-language-server` executables for the GHC versions you plan on working with, and either put them on your PATH or point your client to them.
125+
To install, download the `haskell-language-server-wrapper` executable for your platform as well as any `haskell-language-server` executables for the GHC versions you plan on working with, and either put them on your `PATH` or point your client to them.
135126

136127
## Arch Linux
137128

@@ -143,6 +134,7 @@ See [ArchWiki](https://wiki.archlinux.org/index.php/Haskell) for the details of
143134

144135
## Fedora
145136

137+
146138
Binary packages for Fedora are available from [this Copr repo](https://copr.fedorainfracloud.org/coprs/petersen/haskell-language-server),
147139
built against the official Fedora ghc package.
148140

@@ -157,6 +149,15 @@ pkg install hs-haskell-language-server
157149
to install it. At the moment, HLS installed this way only supports the same GHC
158150
version as the ports one.
159151

152+
## Gentoo
153+
154+
Haskell Language Server is available via the Haskell overlay. Follow the instructions [here](https://github.com/gentoo-haskell/gentoo-haskell) to install the overlay, then run:
155+
156+
```bash
157+
emerge -av dev-util/haskell-language-server
158+
```
159+
Depending on your system setup, you may need to enable the unstable flag for this package before install, and possible also for the dependencies. If you enabled the ~testing versions as explained in the gentoo-haskell overlay instructions, then this won't be necessary.
160+
160161
## Installation from Hackage
161162

162163
Direct installation from Hackage, while possible via `cabal install haskell-language-server`, is not recommended for most people.

0 commit comments

Comments
 (0)