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.
3
4
4
5
## Dependencies and Building
6
+
5
7
For development, all you need is to,
6
8
7
-
- run `npm install -g typescript` to get TypeScript,
8
-
- then run `npm install` in the project root to install development dependencies.
9
+
* run `npm install -g typescript` to get TypeScript,
10
+
* then run `npm install` in the project root to install development dependencies.
9
11
10
12
You can now also package up the extension with,
11
13
12
-
-`vsce package`
14
+
*`vsce package`
13
15
14
16
which creates an extension package at `vscode-hie-server-<version>.vsix`.
15
17
16
18
_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.
17
19
18
20
## Developing
21
+
19
22
* Launch VS Code, press `File` > `Open Folder`, open the `vscode-hie-server` folder;
20
23
* press `F5` to open a new window with the `vscode-hie-server` loaded (this will overwrite existing ones, e.g. from the marketplace);
21
-
* open a Haskell file with the __new__ editor to test the LSP client;
24
+
* open a Haskell file with the **new** editor to test the LSP client;
22
25
23
26
You are now ready to make changes and debug. You can,
24
27
@@ -29,8 +32,18 @@ You are now ready to make changes and debug. You can,
29
32
30
33
_Note_: you can also reload (`Ctrl+R` or `Cmd+R` on macOS) the VS Code window with your extension to load your changes
31
34
35
+
#### Formatting
36
+
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
+
41
+
The configurations for prettier are located in `.prettierrc`.
42
+
32
43
## Navigating the Files
44
+
33
45
A brief overview of the files,
46
+
34
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
35
48
*`src/extension.ts` handles activating and deactivating the HIE language server, along with checking if HIE is installed
36
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`)
@@ -39,12 +52,20 @@ A brief overview of the files,
39
52
*`src/commands/insertType.ts` handles inserting a type using the output of `ghcmod:type`
40
53
41
54
## Helpful Reading Material
55
+
42
56
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.
43
57
44
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
+
45
66
* open the debug viewlet (`Ctrl+Shift+D` or `Cmd+Shift+D` on Mac) and from the launch configuration dropdown pick `Launch Tests`
46
67
* press `F5` to run the tests in a new window with your extension loaded
47
68
* see the output of the test result in the debug console
48
69
* make changes to `test/extension.test.ts` or create new test files inside the `test` folder
49
-
* by convention, the test runner will only consider files matching the name pattern `**.test.ts`
50
-
* you can create folders inside the `test` folder to structure your tests any way you want
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
0 commit comments