Skip to content

Commit 77b157e

Browse files
committed
Clean up description
1 parent 170b594 commit 77b157e

File tree

2 files changed

+45
-43
lines changed

2 files changed

+45
-43
lines changed

CONTRIBUTING.md

+43
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,53 @@
22

33
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.
44

5+
## Other Editors With Language-Server Support
6+
7+
This repo happens to also contain a language-server usable by other editors. If you'd like to use this language-server with e.g. Atom, for now, you have to clone the repo and run `npm run compile`. The language server will be at `server/out/server.js`. Wire that into your editor.
8+
9+
10+
## Repo Structure
11+
12+
```
13+
.
14+
├── client // Language Client
15+
│ ├── src
16+
│ │ └── extension.ts // Language Client entry point
17+
├── package.json // The extension manifest.
18+
└── server // Language Server
19+
└── src
20+
└── server.ts // Language Server entry point
21+
```
22+
23+
## Run the Project
24+
25+
- Run `npm install` at the root. This will also install the necessary npm modules in both the `client` and `server` folders.
26+
- Open VS Code to this folder.
27+
- Switch to the Debug viewlet (command palette -> View: Show Run and Debug).
28+
- Select `Client + Server` from the drop down, launch it (green arrow):
29+
30+
<img width="235" alt="image" src="https://user-images.githubusercontent.com/1909539/97448097-7d186a80-18ed-11eb-82d6-d55b70f54811.png">
31+
32+
(If you're getting some Promise-related error alert, file an issue here so that we can find a workaround; this seems to be a VSCode bug).
33+
- In the [Extension Development Host] instance of VSCode that just opened, open a `.res` file.
34+
- Try various features.
35+
- When you make a change, Go to the same Debug viewlet's Call Stack panel and restart the client and the server:
36+
37+
<img width="359" alt="image" src="https://user-images.githubusercontent.com/1909539/97448639-19db0800-18ee-11eb-875a-d17cd1b141d1.png">
38+
39+
### Change the Grammar
40+
41+
- Modify `grammars/rescript.tmLanguage.json`.
42+
43+
For more grammar inspirations, check:
44+
- [TypeScript's grammar](https://github.com/microsoft/TypeScript-TmLanguage/blob/a771bc4e79deeae81a01d988a273e300290d0072/TypeScript.YAML-tmLanguage)
45+
- [Writing a TextMate Grammar: Some Lessons Learned](https://www.apeth.com/nonblog/stories/textmatebundle.html)
546
## Editor Diagnostics
647

748
They should be synced in from `lib/bs/.compiler.log` build. Don't take them from other places.
849

50+
## Rough Description Of How The Plugin Works
51+
952
### `.compiler.log`
1053

1154
The build output is streamed into `lib/bs/.compiler.log`. Here are its various states, numbered here:

README.md

+2-43
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The official VSCode plugin for ReScript.
44

55
## Prerequisite
66

7-
`bs-platform 8.3.3` installed locally in your project.
7+
You **must** have `bs-platform 8.3.3` installed locally in your project, through the usual [npm installation](https://rescript-lang.org/docs/manual/latest/installation#integrate-into-existing-js-project). Older versions are not guaranteed to work.
88

99
## Installation
1010

@@ -24,47 +24,6 @@ The plugin activates on `.res` and `.resi` files. If you've already got Reason-L
2424
- Jump to location
2525

2626
### Upcoming Features
27+
2728
- Formatting of temporary files
2829
- Formatting of files outside of a ReScript project root
29-
30-
## Develop
31-
32-
### Other Editors With Language-Server Support
33-
This repo happens to also contain a language-server usable by other editors. If you'd like to use this language-server with e.g. Atom, for now, you have to clone the repo and run `npm run compile`. The language server will be at `server/out/server.js`. Wire that into your editor.
34-
35-
### Structure
36-
37-
```
38-
.
39-
├── client // Language Client
40-
│ ├── src
41-
│ │ └── extension.ts // Language Client entry point
42-
├── package.json // The extension manifest.
43-
└── server // Language Server
44-
└── src
45-
└── server.ts // Language Server entry point
46-
```
47-
48-
### Running the Project
49-
50-
- Run `npm install` at the root. This will also install the necessary npm modules in both the `client` and `server` folders.
51-
- Open VS Code to this folder.
52-
- Switch to the Debug viewlet (command palette -> View: Show Run and Debug).
53-
- Select `Client + Server` from the drop down, launch it (green arrow):
54-
55-
<img width="235" alt="image" src="https://user-images.githubusercontent.com/1909539/97448097-7d186a80-18ed-11eb-82d6-d55b70f54811.png">
56-
57-
(If you're getting some Promise-related error alert, file an issue here so that we can find a workaround; this seems to be a VSCode bug).
58-
- In the [Extension Development Host] instance of VSCode that just opened, open a `.res` file.
59-
- Try various features.
60-
- When you make a change, Go to the same Debug viewlet's Call Stack panel and restart the client and the server:
61-
62-
<img width="359" alt="image" src="https://user-images.githubusercontent.com/1909539/97448639-19db0800-18ee-11eb-875a-d17cd1b141d1.png">
63-
64-
#### Change the Grammar
65-
66-
- Modify `grammars/rescript.tmLanguage.json`.
67-
68-
For more grammar inspirations, check:
69-
- [TypeScript's grammar](https://github.com/microsoft/TypeScript-TmLanguage/blob/a771bc4e79deeae81a01d988a273e300290d0072/TypeScript.YAML-tmLanguage)
70-
- [Writing a TextMate Grammar: Some Lessons Learned](https://www.apeth.com/nonblog/stories/textmatebundle.html)

0 commit comments

Comments
 (0)