Skip to content

Commit 3637c48

Browse files
committed
Update contributing guide
1 parent 0dbf2eb commit 3637c48

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

CONTRIBUTING.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing
22

3-
Thanks for your interest. Below is an informal spec of how the plugin's server communicates with the actual compiler. If you're a ReScript editor plugin implementor, you should probably read this to understand the various important nuances.
3+
Thanks for your interest. Below is an informal spec of how the plugin's server communicates with the actual compiler. If you're a ReScript editor plugin implementor, you should probably read this to understand the various important nuances and copy it.
44

55
## Other Editors With Language-Server Support
66

@@ -80,6 +80,8 @@ The compiler log contains exactly the same things you'd see in a regular termina
8080
- The errors are indented 2 spaces
8181
- The extra `#Start` and `#Done` (which aren't indented).
8282

83+
A parser for the diagnostics is [here](https://github.com/rescript-lang/rescript-vscode/blob/0dbf2eb9cdb0bd6d95be1aee88b73830feecb5cc/server/src/utils.ts#L129-L329).
84+
8385
### State 1
8486

8587
Artifacts cleaning through `bsb -clean` removes `.compiler.log` and turns into state 1. If that's the case, remove the diagnostics in the editor too. One could argue that they should be kept, but that's misleading UX-wise, and harder to implement correctly.
@@ -113,17 +115,19 @@ The bad alternatives are:
113115

114116
## Running `bsb` in the Editor
115117

116-
**Don't** do that unless you've prompted the user.
118+
**Don't** do that unless you've prompted the user. This plugin currently prompts the user upon opening thr first the first file of a project. It's not great, but otherwise lots of folks forget to start a `bsb` in the terminal to see the freshest diagnostics.
119+
120+
Drawbacks:
117121

118-
- Running an implicit `bsb -w` automatically means you've acquired the build watch mode lockfile. The user won't be able to run his/her own `bsb -w` in the terminal.
119-
- Running a one-shot `bsb` doesn't conflict, but is a waste. It's also incorrect, as there might be external file system changes you're not detecting.
120-
- The build might be a step in a bigger build. The editor running `bsb` implicitly goes against that.
121-
- If you have multiple files with different project roots open, running all of the `bsb`s is too intense.
122+
- Running an implicit `bsb -w` means you've acquired the build watch mode lockfile. The user won't be able to run his/her own `bsb -w` in the terminal.
123+
- Running a one-shot `bsb` doesn't conflict, but is a waste. It's also incorrect, as there might be external file system changes you're not detecting, e.g. version control changes.
124+
- The build might be a step in a bigger build. The editor running `bsb -w` by itself might clash with that.
125+
- If you have multiple files with different project roots open, running all of the `bsb -w`s is too intense.
122126

123127
## Format
124128

125129
To find the location of `bsc.exe` to run the formatter:
126-
- Search in the file's directory's `node_modules/bs-platform/{platform}/bsc.exe`.
130+
- Search in the file's directory's `node_modules/bs-platform/{platform}/bsc.exe`. If not found, recursively search upward (because [monorepos](https://github.com/rescript-lang/rescript-vscode/blob/0dbf2eb9cdb0bd6d95be1aee88b73830feecb5cc/server/src/utils.ts#L39-L45)).
127131
- Do **not** directly use `node_modules/.bin/bsc` if you can help it. That's a Nodejs wrapper. Slow startup. We don't want our formatting to be momentarily stalled because some Nodejs cache went cold.
128132
- `platform` can be `darwin`, `linux`, `win32` or `freebsd`.
129133

0 commit comments

Comments
 (0)