Skip to content

Commit dfd5a51

Browse files
committed
Merge branch 'master' into add-case-split
2 parents b22027e + 238abfb commit dfd5a51

File tree

11 files changed

+1159
-1105
lines changed

11 files changed

+1159
-1105
lines changed

Changelog.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
### 0.0.19
2+
3+
* Fix hie launch on windows with logging off (#90). Thanks @Tehnix.
4+
5+
### 0.0.18
6+
7+
* Support GHC 8.4.3 in the wrapper file
8+
* The `languageServerHaskell.trace.server` parameter now affects
9+
`/tmp/hie.log`, as well as ghc-mod `--vomit` output.
10+
* Add an Import identifier command, by @chrismwendt
11+
12+
### 0.0.17
13+
14+
* Support GHC 8.4.2 in the wrapper file
15+
* Update dependencies to avoid security vulnerability.
16+
* Use os.tmpdir() for the hie.log file
17+
118
### 0.0.15
219

320
Support the new webview-api for the documentation browser, thanks to @AlexeyRaga.
@@ -38,13 +55,13 @@ Add rudimentary support for detecting the project GHC version and using the
3855
appropriate hie version. This currently only works on Linux (contributors on
3956
other platforms, please jump in with appropriate scripts) and requires
4057
`haskell-ide-engine` built via the `Makefile` added in
41-
https://github.com/haskell/haskell-ide-engine/pull/447. Thanks to @Tehnix
58+
https://github.com/haskell/haskell-ide-engine/pull/447. Thanks to @Tehnix
4259

4360
### 0.0.7
4461

4562
Update `package-lock.json` to fresh dependencies.
4663

47-
Add show type *of selected expression* on hover feature, by @halhenke
64+
Add show type _of selected expression_ on hover feature, by @halhenke
4865

4966
Added options for how to display the same information when using the show type
5067
command menu, by @halhenke

README.md

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,42 @@
11
# Haskell Language Server Client
2+
23
Client interface to the Language Server Protocol server for Haskell, as provided by the Haskell IDE Engine. Check the [requirements](#user-content-requirements) for dependencies.
34

4-
__It is still under development!__ If you want to help, get started by reading [Contributing](https://github.com/alanz/vscode-hie-server/blob/master/Contributing.md) for more details.
5+
**It is still under development!** If you want to help, get started by reading [Contributing](https://github.com/alanz/vscode-hie-server/blob/master/Contributing.md) for more details.
56

67
## Requirements
8+
79
The language client requires you to manually install the [HIE](https://github.com/haskell/haskell-ide-engine) language server,
810

911
```bash
10-
$ git clone https://github.com/haskell/haskell-ide-engine
12+
$ git clone https://github.com/haskell/haskell-ide-engine --recursive
1113
$ cd haskell-ide-engine && make build
1214
```
1315

1416
Alternatively you can just `stack install`, but `make build` will give you the best setup.
1517

1618
## Features
19+
1720
Language server client for haskell using the [HIE](https://github.com/haskell/haskell-ide-engine) language server. Supports,
1821

19-
- Diagnostics via HLint and GHC warnings/errors
20-
- Code actions and quick-fixes via [`apply-refact`](https://github.com/mpickering/apply-refact) (click the lightbulb)
21-
- Type information and documentation (via hoogle) on hover
22-
- Jump to definition (`F12` or `Go to Definition` in command palette)
23-
- List all top level definitions
24-
- Highlight references in document
25-
- Completion
26-
- Formatting via [`brittany`](https://github.com/lspitzner/brittany) (`^ ⌥ B` or `Format Document` in command palette)
27-
- Renaming via [`HaRe`](https://github.com/alanz/HaRe) (`F2` or `Rename Symbol` in command palette)
28-
- [Multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) support
22+
* Diagnostics via HLint and GHC warnings/errors
23+
* Code actions and quick-fixes via [`apply-refact`](https://github.com/mpickering/apply-refact) (click the lightbulb)
24+
* Type information and documentation (via hoogle) on hover
25+
* Jump to definition (`F12` or `Go to Definition` in command palette)
26+
* List all top level definitions
27+
* Highlight references in document
28+
* Completion
29+
* Formatting via [`brittany`](https://github.com/lspitzner/brittany) (`^ ⌥ B` or `Format Document` in command palette)
30+
* Renaming via [`HaRe`](https://github.com/alanz/HaRe) (`F2` or `Rename Symbol` in command palette)
31+
* [Multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) support
2932

3033
Additionally the language server itself features,
31-
- Supports plain GHC projects, cabal projects (sandboxed and non sandboxed) and stack projects
32-
- Fast due to caching of compile info
34+
35+
* Supports plain GHC projects, cabal projects (sandboxed and non sandboxed) and stack projects
36+
* Fast due to caching of compile info
3337

3438
## Extension Settings
39+
3540
You can disable HLint and also control the maximum number of reported problems,
3641

3742
```json
@@ -60,8 +65,8 @@ If you need more control, and want to have a custom wrapper, either in your spec
6065

6166
There are a few placeholders which will be expanded:
6267

63-
- `~`, `${HOME}` and `${home}` will be expanded into your users' home folder.
64-
- `${workspaceFolder}` and `${workspaceRoot}` will expand into your current project root.
68+
* `~`, `${HOME}` and `${home}` will be expanded into your users' home folder.
69+
* `${workspaceFolder}` and `${workspaceRoot}` will expand into your current project root.
6570

6671
This can be beneficial if you are using something like nix, to have a wrapper script tailored to your setup. This will take precedence over `useHieWrapper` and `hieExecutablePath`.
6772

@@ -84,6 +89,7 @@ If you `hie` executable is not on your path, you can manually set it,
8489
The path placeholders work here as well. Note that this adds the `--lsp` argument to the call of this executable.
8590

8691
## Docs on Hover/Generating Hoogle DB
92+
8793
For the most current documentation on this, see [Docs on Hover/Completion](https://github.com/haskell/haskell-ide-engine#docs-on-hovercompletion).
8894

8995
HIE supports fetching docs from haddock on hover. It will fallback on using a hoogle db(generally located in ~/.hoogle on linux)
@@ -110,6 +116,7 @@ $ stack --stack-yaml=<stack.yaml you used to build hie> exec hoogle generate
110116
```
111117

112118
## Manual Installation
119+
113120
Either install the extension via the marketplace (preferred), or if you are testing an unreleased version by,
114121

115122
```bash
@@ -127,35 +134,37 @@ In VS Code, open the extensions tab, and click on the `...` at the top right of
127134
and use the `Install from VSIX...` option to locate and install the generated file.
128135

129136
## Using multi-root workspaces
137+
130138
First, check out [what multi-root workspaces](https://code.visualstudio.com/docs/editor/multi-root-workspaces) are. The idea of using multi-root workspaces, is to be able to work on several different Haskell projects, where the GHC version or stackage LTS could differ, and have it work smoothly.
131139

132140
HIE is now started for each workspace folder you have in your multi-root workspace, and several configurations are on a resource (i.e. folder) scope, instead of window (i.e. global) scope.
133141

134142
To showcase the utility of this, let's imagine that we are writing a full-stack Haskell website, and we have three main components:
135143

136-
- a backend using LTS 10.10 and
137-
- a frontend using GHCJS and LTS 8.11,
138-
- a common part that is shared between the two, using LTS 8.11.
144+
* a backend using LTS 10.10 and
145+
* a frontend using GHCJS and LTS 8.11,
146+
* a common part that is shared between the two, using LTS 8.11.
139147

140148
One way to be able to work on all these in the same VSCode project is to create a new workspace, and then add each folder to the workspace. This way, they are considered separate entities, and HIE will start separately for each.
141149

142150
You can then define how to start HIE for each of these folders, by going into `Settings` and then choosing `Folder Settings -> <the folder you want>`, or just configure the workspace. E.g. the _backend_ and _common_ projects could have a folder settting,
143151

144152
```json
145153
{
146-
"languageServerHaskell.useCustomHieWrapper": true,
147-
"languageServerHaskell.useCustomHieWrapperPath": "${workspaceFolder}/hie.sh"
154+
"languageServerHaskell.useCustomHieWrapper": true,
155+
"languageServerHaskell.useCustomHieWrapperPath": "${workspaceFolder}/hie.sh"
148156
}
149157
```
150158

151159
to launch HIE via `hie.sh` inside the _backend_ and _common_ folder, while the _frontend_, because of using GHCJS, might not want to use HIE, and therefore needs to disable HIE,
152160

153161
```json
154162
{
155-
"languageServerHaskell.useHieWrapper": false
163+
"languageServerHaskell.useHieWrapper": false
156164
}
157165
```
158-
This provides a very flexible way of customizing your setup.
166+
167+
This provides a very flexible way of customizing your setup.
159168

160169
## Release Notes
161170

hie-vscode.bat

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33
set HIE_SERVER_PATH=
44
for /f "delims=" %%p in ('where hie') do set HIE_SERVER_PATH=%%p
55

6-
if [%HIE_SERVER_PATH%] == [] (
6+
set HIE_WRAPPER_PATH=
7+
for /f "delims=" %%p in ('where hie-wrapper') do set HIE_WRAPPER_PATH=%%p
8+
9+
rem Need to check that neither is found
10+
if [%HIE_WRAPPER_PATH%] == [] (
711
echo Content-Length: 100
812
echo:
913
echo {"jsonrpc":"2.0","id":1,"error":{"code":-32099,"message":"Cannot find hie.exe in the path"}}
1014
exit 1
1115
)
1216

13-
hie --lsp %1 %2 %3 %4 %5 %6 %7 %8 %9
17+
rem Need to run hie-wrapper if found, else hie
18+
hie-wrapper --lsp %1 %2 %3 %4 %5 %6 %7 %8 %9

hie-vscode.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
#!/bin/sh
22

33
export HIE_SERVER_PATH=`which hie`
4+
export HIE_WRAPPER_PATH=`which hie-wrapper`
45

5-
if [ "X" = "X$HIE_SERVER_PATH" ]; then
6+
if [ "X" = "X$HIE_WRAPPER_PATH" ]; then
7+
hie-wrapper --lsp $@
8+
elif [ "X" = "X$HIE_SERVER_PATH" ]; then
69
echo "Content-Length: 100\r\n\r"
710
echo '{"jsonrpc":"2.0","id":1,"error":{"code":-32099,"message":"Cannot find hie.exe in the path"}}'
811
exit 1

hie-wrapper-old.sh

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
#!/usr/bin/env bash
2+
DEBUG=1
3+
indent=""
4+
function debug {
5+
if [[ $DEBUG == 1 ]]; then
6+
echo "$indent$@" >> /tmp/hie-wrapper.log
7+
fi
8+
}
9+
10+
curDir=`pwd`
11+
debug "Launching HIE for project located at $curDir"
12+
indent=" "
13+
14+
GHCBIN='ghc'
15+
# If a .stack-work exists, assume we are using stack.
16+
if [ -d ".stack-work" ]; then
17+
debug "Using stack GHC version"
18+
GHCBIN='stack ghc --'
19+
else
20+
debug "Using plain GHC version"
21+
fi
22+
versionNumber=`$GHCBIN --version`
23+
debug $versionNumber
24+
25+
HIEBIN='hie'
26+
BACKUP_HIEBIN='hie'
27+
# Match the version number with a HIE version, and provide a fallback without
28+
# the patch number.
29+
30+
# GHC 8.0.*
31+
if [[ $versionNumber = *"8.0.1"* ]]; then
32+
debug "Project is using GHC 8.0.1"
33+
HIEBIN='hie-8.0.1'
34+
BACKUP_HIEBIN='hie-8.0'
35+
elif [[ $versionNumber = *"8.0.2"* ]]; then
36+
debug "Project is using GHC 8.0.2"
37+
HIEBIN='hie-8.0.2'
38+
BACKUP_HIEBIN='hie-8.0'
39+
elif [[ $versionNumber = *"8.0"* ]]; then
40+
debug "Project is using GHC 8.0.*"
41+
HIEBIN='hie-8.0'
42+
43+
# GHC 8.2.*
44+
elif [[ $versionNumber = *"8.2.1"* ]]; then
45+
debug "Project is using GHC 8.2.1"
46+
HIEBIN='hie-8.2.1'
47+
BACKUP_HIEBIN='hie-8.2'
48+
elif [[ $versionNumber = *"8.2.2"* ]]; then
49+
debug "Project is using GHC 8.2.2"
50+
HIEBIN='hie-8.2.2'
51+
BACKUP_HIEBIN='hie-8.2'
52+
elif [[ $versionNumber = *"8.2"* ]]; then
53+
debug "Project is using GHC 8.2.*"
54+
HIEBIN='hie-8.2'
55+
56+
# GHC 8.4.*
57+
elif [[ $versionNumber = *"8.4.3"* ]]; then
58+
debug "Project is using GHC 8.4.3"
59+
HIEBIN='hie-8.4.3'
60+
BACKUP_HIEBIN='hie-8.4'
61+
elif [[ $versionNumber = *"8.4.2"* ]]; then
62+
debug "Project is using GHC 8.4.2"
63+
HIEBIN='hie-8.4.2'
64+
BACKUP_HIEBIN='hie-8.4'
65+
elif [[ $versionNumber = *"8.4"* ]]; then
66+
debug "Project is using GHC 8.4.*"
67+
HIEBIN='hie-8.4'
68+
69+
else
70+
debug "WARNING: GHC version does not match any of the checked ones."
71+
fi
72+
73+
if [ -x "$(command -v $HIEBIN)" ]; then
74+
debug "$HIEBIN was found on path"
75+
elif [ -x "$(command -v $BACKUP_HIEBIN)" ]; then
76+
debug "Backup $BACKUP_HIEBIN was found on path"
77+
HIEBIN=$BACKUP_HIEBIN
78+
else
79+
debug "Falling back to plain hie"
80+
HIEBIN='hie'
81+
fi
82+
83+
debug "Starting HIE"
84+
85+
# Check that HIE is working
86+
export HIE_SERVER_PATH=`which $HIEBIN`
87+
88+
if [ "X" = "X$HIE_SERVER_PATH" ]; then
89+
echo "Content-Length: 100\r\n\r"
90+
echo '{"jsonrpc":"2.0","id":1,"error":{"code":-32099,"message":"Cannot find hie in the path"}}'
91+
exit 1
92+
fi
93+
94+
# Run directly
95+
$HIEBIN --lsp $@
96+
# $HIEBIN --lsp
97+
98+
# Run with a log
99+
# $HIEBIN --lsp -d -l /tmp/hie.log $@
100+
# $HIEBIN --lsp -d -l /tmp/hie.log --ekg $@
101+
# $HIEBIN --lsp -d -l /tmp/hie.log --vomit $@
102+
103+
# Run with a log and a direct dump of the server output
104+
# $HIEBIN --lsp -d -l /tmp/hie.log | tee /tmp/hie-wire.log

hie-wrapper.sh

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,57 +11,8 @@ curDir=`pwd`
1111
debug "Launching HIE for project located at $curDir"
1212
indent=" "
1313

14-
GHCBIN='ghc'
15-
# If a .stack-work exists, assume we are using stack.
16-
if [ -d ".stack-work" ]; then
17-
debug "Using stack GHC version"
18-
GHCBIN='stack ghc --'
19-
else
20-
debug "Using plain GHC version"
21-
fi
22-
versionNumber=`$GHCBIN --version`
23-
debug $versionNumber
24-
25-
HIEBIN='hie'
26-
BACKUP_HIEBIN='hie'
27-
# Match the version number with a HIE version, and provide a fallback without
28-
# the patch number.
29-
if [[ $versionNumber = *"8.0.1"* ]]; then
30-
debug "Project is using GHC 8.0.1"
31-
HIEBIN='hie-8.0.1'
32-
BACKUP_HIEBIN='hie-8.0'
33-
elif [[ $versionNumber = *"8.0.2"* ]]; then
34-
debug "Project is using GHC 8.0.2"
35-
HIEBIN='hie-8.0.2'
36-
BACKUP_HIEBIN='hie-8.0'
37-
elif [[ $versionNumber = *"8.0"* ]]; then
38-
debug "Project is using GHC 8.0.*"
39-
HIEBIN='hie-8.0'
40-
elif [[ $versionNumber = *"8.2.1"* ]]; then
41-
debug "Project is using GHC 8.2.1"
42-
HIEBIN='hie-8.2.1'
43-
BACKUP_HIEBIN='hie-8.2'
44-
elif [[ $versionNumber = *"8.2.2"* ]]; then
45-
debug "Project is using GHC 8.2.2"
46-
HIEBIN='hie-8.2.2'
47-
BACKUP_HIEBIN='hie-8.2'
48-
elif [[ $versionNumber = *"8.2"* ]]; then
49-
debug "Project is using GHC 8.2.*"
50-
HIEBIN='hie-8.2'
51-
else
52-
debug "WARNING: GHC version does not match any of the checked ones."
53-
fi
54-
55-
if [ -x "$(command -v $HIEBIN)" ]; then
56-
debug "$HIEBIN was found on path"
57-
elif [ -x "$(command -v $BACKUP_HIEBIN)" ]; then
58-
debug "Backup $BACKUP_HIEBIN was found on path"
59-
HIEBIN=$BACKUP_HIEBIN
60-
else
61-
debug "Falling back to plain hie"
62-
HIEBIN='hie'
63-
fi
6414

15+
HIEBIN='hie-wrapper'
6516
debug "Starting HIE"
6617

6718
# Check that HIE is working

0 commit comments

Comments
 (0)