Skip to content

Commit f033a10

Browse files
committed
Add Mermaid diagrams
1 parent d216af4 commit f033a10

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

CONTRIBUTING.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,59 @@ We call a few binaries and it's tricky to call them properly cross-platform. Her
112112

113113
## Rough Description Of How The Plugin Works
114114

115+
### Text Changes
116+
117+
The flow below shows how the LSP server reacts to incremental text changes and produces diagnostics:
118+
119+
```mermaid
120+
flowchart TD
121+
A[Your ReScript file in your editor]
122+
B[LSP Client]
123+
C[LSP Server]
124+
D[bsc]
125+
126+
A -->|Type a character| B
127+
B -->|textDocument/didChange| C
128+
129+
subgraph LSP_Server_Internal_Flow["LSP Server"]
130+
C1[triggerIncrementalCompilationOfFile]
131+
C2[compileContents]
132+
C3[figureOutBscArgs]
133+
C4[parse .compiler.log]
134+
end
135+
136+
C --> C1
137+
C1 --> C2 --> C3
138+
C3 -->|invoke| D
139+
D -->|writes| C4
140+
C4 -->|textDocument/publishDiagnostics| B
141+
```
142+
143+
### Completion
144+
145+
The flow below shows how the LSP server handles completion requests by delegating to the native analysis binary:
146+
147+
```mermaid
148+
flowchart TD
149+
A[Your ReScript file in your editor]
150+
B[LSP Client]
151+
C[LSP Server]
152+
D[rescript-editor-analysis.exe]
153+
154+
A -->|Trigger completion| B
155+
B -->|textDocument/completion| C
156+
157+
subgraph LSP_Server_Internal_Flow["LSP Server"]
158+
C1[shell out to rescript-editor-analysis.exe]
159+
C2[build completion response]
160+
end
161+
162+
C --> C1
163+
C1 -->|exec| D
164+
D --> C2
165+
C2 -->|textDocument/completion response| B
166+
```
167+
115168
### Editor Diagnostics
116169

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

0 commit comments

Comments
 (0)