|
1 | 1 | # Development guide |
2 | 2 |
|
3 | | -**Note:** This is outdated until I figure out how to distribute this extension |
4 | | -in a way that actually works on other peoples computers. |
5 | | - |
6 | | -This guide will help you set up your local development environment. |
7 | | - |
8 | 3 | There are two moving parts. |
9 | 4 |
|
10 | 5 | - **Server**: A node server written in Typescript that implements the |
11 | | - [Language Server Protocol (LSP)][lsp]. |
12 | | -- **Client**: A super tiny vscode extension which basically just tells vscode |
13 | | - how to launch the LSP server. |
| 6 | + [Language Server Protocol (LSP)][LSP]. |
| 7 | + |
| 8 | +- **Client**: A super tiny Visual Studio Code (vscode) extension which basically |
| 9 | + just tells vscode how to launch the LSP server. |
14 | 10 |
|
15 | 11 | The project has a root `package.json` file which is really just there for |
16 | 12 | convenience - it proxies to the `package.json` files in the `vscode-client` and |
17 | 13 | `server` folders. |
18 | 14 |
|
19 | | -To **install all the required dependencies** run |
| 15 | +## Initial setup |
| 16 | + |
| 17 | +Run the following in the root of the project |
20 | 18 |
|
21 | 19 | ``` |
22 | 20 | npm install |
23 | 21 | ``` |
24 | 22 |
|
25 | 23 | This uses the `postinstall` hook to install the dependencies in each of the |
26 | | -sub-projects as well as using [npm link][npm-link] to get your local client to |
27 | | -use your local version of the server. |
| 24 | +sub-projects. |
28 | 25 |
|
29 | | -To **compile everything** run |
| 26 | +To make sure that everything is configured correctly run the following command |
| 27 | +to compile both the client and the server once |
30 | 28 |
|
31 | 29 | ``` |
32 | 30 | npm run compile |
33 | 31 | ``` |
34 | 32 |
|
35 | | -Now, as most of the interesting things are happening in the server you'll probably want to |
36 | | -re-compile it whenever you make a change to any of the source files: |
| 33 | +Now, depending on which part you want to work on follow the relevant section |
| 34 | +below. |
| 35 | + |
| 36 | +## Working on the client |
| 37 | + |
| 38 | +Working on the client is simply a matter of starting vscode and using the Debug |
| 39 | +View to launch the `Launch Client` task. This will open a new vscode window with the |
| 40 | +extension loaded. It also looks for changes to your client code and recompiles |
| 41 | +it whenever you save your changes. |
| 42 | + |
| 43 | +## Working on the server |
| 44 | + |
| 45 | +The easiest way right now is to simple compile and install the server globally |
| 46 | +whenever you've made a change, and then reload you vscode window to re-launch |
| 47 | +the server. |
37 | 48 |
|
38 | 49 | ``` |
39 | | -npm run watch:server |
| 50 | +cd server |
| 51 | +npm run compile |
| 52 | +npm i -g . |
| 53 | +# Reload vscode window. |
40 | 54 | ``` |
41 | 55 |
|
42 | | -Finally Launch the extension using `Launch Client` task from within vscode. For |
43 | | -now you'll have to re-launch the extension whenever you've made any changes to |
44 | | -the source. |
| 56 | +I'm open to suggestions on how to improve this workflow. |
45 | 57 |
|
46 | | -[lsp]: https://microsoft.github.io/language-server-protocol/ |
47 | | -[node-gyp]: https://github.com/nodejs/node-gyp |
48 | | -[npm-link]: https://docs.npmjs.com/cli/link |
| 58 | +[LSP]: https://microsoft.github.io/language-server-protocol/ |
0 commit comments