You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This document will briefly outline how to get started contributing to the `vscode-hie-server` Haskell language client for the [Haskell-IDE-Engine](https://github.com/haskell/haskell-ide-engine) language server.
4
-
5
3
## Dependencies and Building
6
4
7
-
For development, all you need is to,
8
-
9
-
* run `npm install -g typescript` to get [TypeScript](https://www.typescriptlang.org),
10
-
* run `npm install -g webpack` to get [Webpack](https://webpack.js.org),
11
-
* then run `npm install` in the project root to install development dependencies.
5
+
Run `npm install` in the project root to install the development dependencies.
12
6
13
-
You can now also package up the extension with,
7
+
You can also package up the extension with
14
8
15
-
*`npm install -g vsce` to get the Extension Manager,
16
-
*`vsce package` which creates an extension package at `vscode-hie-server-<version>.vsix`.
9
+
-`npm install -g vsce` to get the Extension Manager,
10
+
-`vsce package` which creates an extension package at `vscode-hie-server-<version>.vsix`.
17
11
18
12
_Note:_ that if you get errors running `vsce package`, it might help running `tsc -p ./` directly, since that gives the actual error output of the TypeScript compilation.
19
13
20
-
## Developing
14
+
## Developing inside VS Code
21
15
22
-
* Launch VS Code, press `File` > `Open Folder`, open the `vscode-hie-server` folder;
23
-
* press `F5` to open a new window with the `vscode-hie-server` loaded (this will overwrite existing ones, e.g. from the marketplace);
24
-
* open a Haskell file with the **new** editor to test the LSP client;
16
+
- Launch VS Code, press `File` > `Open Folder`, open the `vscode-hie-server` folder;
17
+
- press `F5` to open a new window with the `vscode-hie-server` loaded (this will overwrite existing ones, e.g. from the marketplace);
18
+
- open a Haskell file with the **new** editor to test the LSP client;
25
19
26
20
You are now ready to make changes and debug. You can,
27
21
28
-
* set breakpoints in your code inside `src/extension.ts` to debug your extension;
29
-
* find output from your extension in the debug console;
30
-
* make changes to the code, and then
31
-
* relaunch the extension from the debug toolbar
22
+
- set breakpoints in your code inside `src/extension.ts` to debug your extension;
23
+
- find output from your extension in the debug console;
24
+
- make changes to the code, and then
25
+
- relaunch the extension from the debug toolbar
32
26
33
27
_Note_: you can also reload (`Ctrl+R` or `Cmd+R` on macOS) the VS Code window with your extension to load your changes
34
28
35
29
#### Formatting
36
30
37
-
To keep a consistent style, it's best to run [prettier](https://prettier.io) on each save. If you are using VSCode, the settings are set to auto format on save.
38
-
39
-
There is usually an extension for your editor for prettier, e.g. [`esbenp.prettier-vscode`](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode), which you can install through the marketplace or via `ext install prettier-vscode`.
40
-
31
+
[prettier](https://prettier.io) is automatically run o neach commit via husky. If you are developing within VS Code, the settings are set to auto format on save.
41
32
The configurations for prettier are located in `.prettierrc`.
42
33
43
34
## Navigating the Files
44
35
45
36
A brief overview of the files,
46
37
47
-
*`package.json` contains the basic information about the package, see [the full manifest for more](https://code.visualstudio.com/docs/extensionAPI/extension-manifest), such as telling VS Code which scope the LSP works on (Haskell and Literate Haskell in our case), and possible configuration
48
-
*`src/extension.ts` handles activating and deactivating the HIE language server, along with checking if HIE is installed
49
-
*`src/docsBrowser.ts` contains the logic for displaying the documentation browser (e.g. hover over a type like `mapM_` and click `Documentation` or `Source`)
50
-
*`src/commands/constants.ts` simply exports the rest of the commands in folder
51
-
*`src/commands/showType.ts` handles showing a type using `ghcmod:type`
52
-
*`src/commands/insertType.ts` handles inserting a type using the output of `ghcmod:type`
38
+
-`package.json` contains the basic information about the package, see [the full manifest for more](https://code.visualstudio.com/docs/extensionAPI/extension-manifest), such as telling VS Code which scope the LSP works on (Haskell and Literate Haskell in our case), and possible configuration
39
+
-`src/extension.ts` is the main entrypoint to the extension, and handles launching the language server.
40
+
-`src/hlsBinaries.ts` handles automatically installing the pre-built `haskell-language-server` binaries
41
+
-`src/utils.ts` has some functions for downloading files and checking if executables are on the path
42
+
-`src/docsBrowser.ts` contains the logic for displaying the documentation browser (e.g. hover over a type like `mapM_` and click `Documentation` or `Source`)
53
43
54
44
## Helpful Reading Material
55
45
56
46
We recommend checking out [Your First VS Code Extension](https://code.visualstudio.com/docs/extensions/example-hello-world) and [Creating a Language Server](https://code.visualstudio.com/docs/extensions/example-language-server) for some introduction to VS Code extensions.
57
-
58
-
## Running tests
59
-
60
-
There are two ways to run (the same) tests, you can either
61
-
62
-
* press `F8` to run the tests using `npm test`
63
-
64
-
or
65
-
66
-
* open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Launch Tests`
67
-
* press `F5` to run the tests in a new window with your extension loaded
68
-
* see the output of the test result in the debug console
69
-
* make changes to `test/extension.test.ts` or create new test files inside the `test` folder
70
-
* by convention, the test runner will only consider files matching the name pattern `**.test.ts`
71
-
* you can create folders inside the `test` folder to structure your tests any way you want
Copy file name to clipboardExpand all lines: README.md
+28-34Lines changed: 28 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,14 +5,15 @@ This is the Visual Studio Code extension for the [Haskell programming language](
5
5
## Features
6
6
7
7
- Warning and error diagnostics from GHC
8
-
- Code actions and quick-fixes via [`apply-refact`](https://github.com/mpickering/apply-refact) (click the lightbulb)
9
8
- Type information and documentation on hover
10
9
- Jump to definition
11
10
- Document symbols
12
11
- Highlight references in document
13
12
- Code completion
14
13
- Formatting via Brittany, Floskell, Ormolu or Stylish Haskell
15
14
-[Multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces) support
15
+
<!-- Add this back when hlint support is merged into hls
16
+
- Code actions and quick-fixes via `hlint` and [`apply-refact`](https://github.com/mpickering/apply-refact) (click the lightbulb) -->
16
17
17
18
## Requirements
18
19
@@ -22,23 +23,27 @@ This is the Visual Studio Code extension for the [Haskell programming language](
22
23
23
24
## Supported GHC versions
24
25
26
+
Note that these are the versions of GHC that there are binaries of haskell-language-server for. Building from source may support more versions!
27
+
25
28
| GHC | Linux | macOS | Windows |
26
29
| ------ | ----- | ----- | ------- |
27
30
| 8.10.1 | ✓ | ✓ | ✓ |
28
-
| 8.8.3 | ✓ | ✓ |
29
-
| 8.8.2 | ✓ | ✓ |
31
+
| 8.8.3 | ✓ | ✓ ||
32
+
| 8.8.2 | ✓ | ✓ ||
30
33
| 8.6.5 | ✓ | ✓ | ✓ |
31
34
| 8.6.4 | ✓ | ✓ | ✓ |
32
35
33
36
## Language Servers
34
37
35
-
This extension also supports several other language servers for Haskell, some which need to be manually installed:
38
+
This extension is powered by the Haskell Language Server by default, but it also supports several others, some which need to be manually installed:
36
39
37
-
-[Haskell Language Server](https://github.com/haskell/haskell-language-server#installation): This is the default language server which will automatically be downloaded, so no installation should be needed. It builds upon ghcide by providing extra plugins and features.
40
+
-[Haskell Language Server](https://github.com/haskell/haskell-language-server#installation): This is the default language server which will automatically be downloaded, so it does not need manual installation. It builds upon ghcide by providing extra plugins and features.
38
41
-[ghcide](https://github.com/digital-asset/ghcide#install-ghcide): A fast and reliable LSP server with support for [basic features](https://github.com/digital-asset/ghcide#features).
39
42
-[Haskell IDE Engine](https://github.com/haskell/haskell-ide-engine#installation): A stable and mature language server, but note that development has moved from this to the Haskell Language Server.
40
43
41
-
## Extension Settings
44
+
You can choose which language server to use from the "Haskell > Language Server Variant" configuration option.
45
+
46
+
## Configuration options
42
47
43
48
You can disable HLint and also control the maximum number of reported problems,
44
49
@@ -47,13 +52,6 @@ You can disable HLint and also control the maximum number of reported problems,
47
52
"haskell.maxNumberOfProblems": 100,
48
53
```
49
54
50
-
If the liquid haskell executable is installed, enable using it to
51
-
process haskell files on save.
52
-
53
-
```json
54
-
"haskell.liquidOn": true,
55
-
```
56
-
57
55
### Enable/disable server
58
56
59
57
You can enable or disable the chosen haskell language server via configuration. This is sometimes useful at workspace level, because multi-root workspaces do not yet allow you to manage extensions at the folder level, which can be necessary.
@@ -97,39 +95,31 @@ Or alternatively add the following to your `~/.cabal/config` or `cabal.config[.l
97
95
documentation: True
98
96
```
99
97
100
-
###Haskell IDE Engine and Hoogle
98
+
## Haskell IDE Engine specifics
101
99
102
-
If you are using Haskell IDE Engine as the language server, it pulls in documentation via Hoogle. After installing Hoogle via `cabal install hoogle` or `stack install hoogle`, generate the database with:
100
+
If you are using Haskell IDE Engine as your language server, there are a number of additional configuration options.
103
101
104
-
```bash
105
-
$ hoogle generate
106
-
```
102
+
### Liquid Haskell
107
103
108
-
Haskell IDE Engine
104
+
If Liquid Haskell is installed, haskell-ide-engine can be configured to run the `liquidhaskell` executable on save and display diagnostics:
109
105
110
-
## Manual Installation
106
+
```json
107
+
"haskell.liquidOn": true,
108
+
```
111
109
112
-
Either install the extension via the marketplace (preferred), or if you are testing an unreleased version by,
110
+
### Hoogle
111
+
112
+
HIE pulls in documentation via Hoogle. After installing Hoogle via `cabal install hoogle` or `stack install hoogle`, generate the database with:
This will create a file something like `vscode-hie-server-<version>.vsix`
123
-
according to the current version.
124
-
125
-
In VS Code, open the extensions tab, and click on the `...` at the top right of it,
126
-
and use the `Install from VSIX...` option to locate and install the generated file.
127
-
128
118
## Using multi-root workspaces
129
119
130
120
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.
131
121
132
-
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.
122
+
The language server 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.
133
123
134
124
## Downloaded language servers
135
125
@@ -141,6 +131,9 @@ This extension will download the language server binaries to a specific location
141
131
| Linux | TODO |
142
132
143
133
134
+
Note that if `haskell-language-server-wrapper` is already on the PATH, then the extension will launch it directly instead of downloading binaries.
135
+
136
+
144
137
## Investigating and reporting problems
145
138
146
139
1. Go to extensions and right click `Haskell` and choose `Configure Extensions Settings`
@@ -149,7 +142,7 @@ This extension will download the language server binaries to a specific location
149
142
4. Go to the main menu and choose `View -> Output` (`Ctrl + Shift + U`)
150
143
5. On the new Output panel that opens on the right side in the drop down menu choose `Haskell`
151
144
152
-
Now you will see the information which you can use to diagnose or report a problem
145
+
Please include the output when filing any issues on the relevant language server's issue tracker.
153
146
154
147
### Troubleshooting
155
148
@@ -160,6 +153,7 @@ Now you will see the information which you can use to diagnose or report a probl
160
153
**Common issues*:
161
154
* For now, the extension is not able to open a single haskell source file. You need to open a workspace or folder, configured to be built with cabal, stack or other hie-bios compatible program.
162
155
* Check you don't have other haskell extensions active, they can interfere with each other.
156
+
163
157
## Contributing
164
158
165
159
If you want to help, get started by reading [Contributing](https://github.com/alanz/vscode-hie-server/blob/master/Contributing.md) for more details.
0 commit comments