aboutsummaryrefslogtreecommitdiff
path: root/docs/dev
diff options
context:
space:
mode:
Diffstat (limited to 'docs/dev')
-rw-r--r--docs/dev/architecture.md11
-rw-r--r--docs/dev/lsp-extensions.md20
-rw-r--r--docs/dev/style.md2
3 files changed, 16 insertions, 17 deletions
diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md
index ead12616e..fb991133a 100644
--- a/docs/dev/architecture.md
+++ b/docs/dev/architecture.md
@@ -46,7 +46,7 @@ This is *the* entry point, but it front-loads a lot of complexity, so its fine t
46 46
47`crates/rust-analyzer/src/handlers.rs` implements all LSP requests and is a great place to start if you are already familiar with LSP. 47`crates/rust-analyzer/src/handlers.rs` implements all LSP requests and is a great place to start if you are already familiar with LSP.
48 48
49`Analysis` and `AnalysisHost` types define the main API. 49`Analysis` and `AnalysisHost` types define the main API for consumers of IDE services.
50 50
51## Code Map 51## Code Map
52 52
@@ -97,13 +97,13 @@ See [RFC](https://github.com/rust-lang/rfcs/pull/2256) and [./syntax.md](./synta
97 97
98- [rowan](https://github.com/rust-analyzer/rowan) library is used for constructing syntax trees. 98- [rowan](https://github.com/rust-analyzer/rowan) library is used for constructing syntax trees.
99- `ast` provides a type safe API on top of the raw `rowan` tree. 99- `ast` provides a type safe API on top of the raw `rowan` tree.
100- `ungrammar` description of the grammar, which is used to generate `syntax_kinds` and `ast` modules, using `cargo xtask codegen` command. 100- `ungrammar` description of the grammar, which is used to generate `syntax_kinds` and `ast` modules, using `cargo test -p xtask` command.
101 101
102Tests for ra_syntax are mostly data-driven. 102Tests for ra_syntax are mostly data-driven.
103`test_data/parser` contains subdirectories with a bunch of `.rs` (test vectors) and `.txt` files with corresponding syntax trees. 103`test_data/parser` contains subdirectories with a bunch of `.rs` (test vectors) and `.txt` files with corresponding syntax trees.
104During testing, we check `.rs` against `.txt`. 104During testing, we check `.rs` against `.txt`.
105If the `.txt` file is missing, it is created (this is how you update tests). 105If the `.txt` file is missing, it is created (this is how you update tests).
106Additionally, running `cargo xtask codegen` will walk the grammar module and collect all `// test test_name` comments into files inside `test_data/parser/inline` directory. 106Additionally, running the xtask test suite with `cargo test -p xtask` will walk the grammar module and collect all `// test test_name` comments into files inside `test_data/parser/inline` directory.
107 107
108To update test data, run with `UPDATE_EXPECT` variable: 108To update test data, run with `UPDATE_EXPECT` variable:
109 109
@@ -111,7 +111,7 @@ To update test data, run with `UPDATE_EXPECT` variable:
111env UPDATE_EXPECT=1 cargo qt 111env UPDATE_EXPECT=1 cargo qt
112``` 112```
113 113
114After adding a new inline test you need to run `cargo xtest codegen` and also update the test data as described above. 114After adding a new inline test you need to run `cargo test -p xtask` and also update the test data as described above.
115 115
116Note [`api_walkthrough`](https://github.com/rust-analyzer/rust-analyzer/blob/2fb6af89eb794f775de60b82afe56b6f986c2a40/crates/ra_syntax/src/lib.rs#L190-L348) 116Note [`api_walkthrough`](https://github.com/rust-analyzer/rust-analyzer/blob/2fb6af89eb794f775de60b82afe56b6f986c2a40/crates/ra_syntax/src/lib.rs#L190-L348)
117in particular: it shows off various methods of working with syntax tree. 117in particular: it shows off various methods of working with syntax tree.
@@ -308,9 +308,8 @@ This sections talks about the things which are everywhere and nowhere in particu
308### Code generation 308### Code generation
309 309
310Some of the components of this repository are generated through automatic processes. 310Some of the components of this repository are generated through automatic processes.
311`cargo xtask codegen` runs all generation tasks. 311Generated code is updated automatically on `cargo test`.
312Generated code is generally committed to the git repository. 312Generated code is generally committed to the git repository.
313There are tests to check that the generated code is fresh.
314 313
315In particular, we generate: 314In particular, we generate:
316 315
diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md
index 164c8482e..dd3ecc18d 100644
--- a/docs/dev/lsp-extensions.md
+++ b/docs/dev/lsp-extensions.md
@@ -39,7 +39,7 @@ If a language client does not know about `rust-analyzer`'s configuration options
39 39
40**Issue:** https://github.com/microsoft/language-server-protocol/issues/724 40**Issue:** https://github.com/microsoft/language-server-protocol/issues/724
41 41
42**Client Capability:** `{ "snippetTextEdit": boolean }` 42**Experimental Client Capability:** `{ "snippetTextEdit": boolean }`
43 43
44If this capability is set, `WorkspaceEdit`s returned from `codeAction` requests might contain `SnippetTextEdit`s instead of usual `TextEdit`s: 44If this capability is set, `WorkspaceEdit`s returned from `codeAction` requests might contain `SnippetTextEdit`s instead of usual `TextEdit`s:
45 45
@@ -72,7 +72,7 @@ At the moment, rust-analyzer guarantees that only a single edit will have `Inser
72 72
73**Issue:** https://github.com/microsoft/language-server-protocol/issues/994 73**Issue:** https://github.com/microsoft/language-server-protocol/issues/994
74 74
75**Client Capability:** `{ "codeActionGroup": boolean }` 75**Experimental Client Capability:** `{ "codeActionGroup": boolean }`
76 76
77If this capability is set, `CodeAction` returned from the server contain an additional field, `group`: 77If this capability is set, `CodeAction` returned from the server contain an additional field, `group`:
78 78
@@ -119,7 +119,7 @@ Invoking code action at this position will yield two code actions for importing
119 119
120**Issue:** https://github.com/microsoft/language-server-protocol/issues/1002 120**Issue:** https://github.com/microsoft/language-server-protocol/issues/1002
121 121
122**Server Capability:** `{ "parentModule": boolean }` 122**Experimental Server Capability:** `{ "parentModule": boolean }`
123 123
124This request is sent from client to server to handle "Goto Parent Module" editor action. 124This request is sent from client to server to handle "Goto Parent Module" editor action.
125 125
@@ -153,7 +153,7 @@ mod foo;
153 153
154**Issue:** https://github.com/microsoft/language-server-protocol/issues/992 154**Issue:** https://github.com/microsoft/language-server-protocol/issues/992
155 155
156**Server Capability:** `{ "joinLines": boolean }` 156**Experimental Server Capability:** `{ "joinLines": boolean }`
157 157
158This request is sent from client to server to handle "Join Lines" editor action. 158This request is sent from client to server to handle "Join Lines" editor action.
159 159
@@ -200,7 +200,7 @@ fn main() {
200 200
201**Issue:** https://github.com/microsoft/language-server-protocol/issues/1001 201**Issue:** https://github.com/microsoft/language-server-protocol/issues/1001
202 202
203**Server Capability:** `{ "onEnter": boolean }` 203**Experimental Server Capability:** `{ "onEnter": boolean }`
204 204
205This request is sent from client to server to handle <kbd>Enter</kbd> keypress. 205This request is sent from client to server to handle <kbd>Enter</kbd> keypress.
206 206
@@ -251,7 +251,7 @@ As proper cursor positioning is raison-d'etat for `onEnter`, it uses `SnippetTex
251 251
252## Structural Search Replace (SSR) 252## Structural Search Replace (SSR)
253 253
254**Server Capability:** `{ "ssr": boolean }` 254**Experimental Server Capability:** `{ "ssr": boolean }`
255 255
256This request is sent from client to server to handle structural search replace -- automated syntax tree based transformation of the source. 256This request is sent from client to server to handle structural search replace -- automated syntax tree based transformation of the source.
257 257
@@ -293,7 +293,7 @@ SSR with query `foo($a, $b) ==>> ($a).foo($b)` will transform, eg `foo(y + 5, z)
293 293
294**Issue:** https://github.com/microsoft/language-server-protocol/issues/999 294**Issue:** https://github.com/microsoft/language-server-protocol/issues/999
295 295
296**Server Capability:** `{ "matchingBrace": boolean }` 296**Experimental Server Capability:** `{ "matchingBrace": boolean }`
297 297
298This request is sent from client to server to handle "Matching Brace" editor action. 298This request is sent from client to server to handle "Matching Brace" editor action.
299 299
@@ -338,7 +338,7 @@ Moreover, it would be cool if editors didn't need to implement even basic langua
338 338
339**Issue:** https://github.com/microsoft/language-server-protocol/issues/944 339**Issue:** https://github.com/microsoft/language-server-protocol/issues/944
340 340
341**Server Capability:** `{ "runnables": { "kinds": string[] } }` 341**Experimental Server Capability:** `{ "runnables": { "kinds": string[] } }`
342 342
343This request is sent from client to server to get the list of things that can be run (tests, binaries, `cargo check -p`). 343This request is sent from client to server to get the list of things that can be run (tests, binaries, `cargo check -p`).
344 344
@@ -421,7 +421,7 @@ Reloads project information (that is, re-executes `cargo metadata`).
421 421
422## Status Notification 422## Status Notification
423 423
424**Client Capability:** `{ "statusNotification": boolean }` 424**Experimental Client Capability:** `{ "statusNotification": boolean }`
425 425
426**Method:** `rust-analyzer/status` 426**Method:** `rust-analyzer/status`
427 427
@@ -519,7 +519,7 @@ interface InlayHint {
519 519
520## Hover Actions 520## Hover Actions
521 521
522**Client Capability:** `{ "hoverActions": boolean }` 522**Experimental Client Capability:** `{ "hoverActions": boolean }`
523 523
524If this capability is set, `Hover` request returned from the server might contain an additional field, `actions`: 524If this capability is set, `Hover` request returned from the server might contain an additional field, `actions`:
525 525
diff --git a/docs/dev/style.md b/docs/dev/style.md
index 93ad98f20..46bd8b9b2 100644
--- a/docs/dev/style.md
+++ b/docs/dev/style.md
@@ -145,7 +145,7 @@ Formatting ensures that you can use your editor's "number of selected characters
145## Marked Tests 145## Marked Tests
146 146
147Use 147Use
148[`mark::hit! / mark::check!`](https://github.com/rust-analyzer/rust-analyzer/blob/71fe719dd5247ed8615641d9303d7ca1aa201c2f/crates/test_utils/src/mark.rs) 148[`cov_mark::hit! / cov_mark::check!`](https://github.com/matklad/cov-mark)
149when testing specific conditions. 149when testing specific conditions.
150Do not place several marks into a single test or condition. 150Do not place several marks into a single test or condition.
151Do not reuse marks between several tests. 151Do not reuse marks between several tests.