diff options
author | Aleksey Kladov <[email protected]> | 2018-10-14 23:14:47 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-10-14 23:14:47 +0100 |
commit | b8a96dcf14fd834c7d9beaaeb58ddb0ed52d2349 (patch) | |
tree | 55c120408635d6534c96daacd30b847deb1f5289 | |
parent | f77fdbc9d24c0bea82f38ac73cdc1bf9ff00f39a (diff) |
Apply review suggestions
-rw-r--r-- | ARCHITECTURE.md | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index f046ca35b..b497cc5d7 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md | |||
@@ -11,8 +11,8 @@ Some of the components of this repository are generated through automatic | |||
11 | processes. These are outlined below: | 11 | processes. These are outlined below: |
12 | 12 | ||
13 | - `gen-kinds`: The kinds of tokens are reused in several places, so a generator | 13 | - `gen-kinds`: The kinds of tokens are reused in several places, so a generator |
14 | is used. This process uses [tera] to generate, using data in [grammar.ron], | 14 | is used. We use tera templates to generate the files listed below, based on |
15 | the files: | 15 | the grammar described in [grammar.ron]: |
16 | - [ast/generated.rs][ast generated] in `ra_syntax` based on | 16 | - [ast/generated.rs][ast generated] in `ra_syntax` based on |
17 | [ast/generated.tera.rs][ast source] | 17 | [ast/generated.tera.rs][ast source] |
18 | - [syntax_kinds/generated.rs][syntax_kinds generated] in `ra_syntax` based on | 18 | - [syntax_kinds/generated.rs][syntax_kinds generated] in `ra_syntax` based on |
@@ -21,9 +21,9 @@ processes. These are outlined below: | |||
21 | [tera]: https://tera.netlify.com/ | 21 | [tera]: https://tera.netlify.com/ |
22 | [grammar.ron]: ./crates/ra_syntax/src/grammar.ron | 22 | [grammar.ron]: ./crates/ra_syntax/src/grammar.ron |
23 | [ast generated]: ./crates/ra_syntax/src/ast/generated.rs | 23 | [ast generated]: ./crates/ra_syntax/src/ast/generated.rs |
24 | [ast source]: ./crates/ra_syntax/src/ast/generated.tera.rs | 24 | [ast source]: ./crates/ra_syntax/src/ast/generated.rs.tera |
25 | [syntax_kinds generated]: ./crates/ra_syntax/src/syntax_kinds/generated.rs | 25 | [syntax_kinds generated]: ./crates/ra_syntax/src/syntax_kinds/generated.rs |
26 | [syntax_kinds source]: ./crates/ra_syntax/src/syntax_kinds/generated.tera.rs | 26 | [syntax_kinds source]: ./crates/ra_syntax/src/syntax_kinds/generated.rs.tera |
27 | 27 | ||
28 | 28 | ||
29 | ## Code Walk-Through | 29 | ## Code Walk-Through |
@@ -36,7 +36,7 @@ notes. | |||
36 | 36 | ||
37 | - [rowan](https://github.com/rust-analyzer/rowan) library is used for constructing syntax trees. | 37 | - [rowan](https://github.com/rust-analyzer/rowan) library is used for constructing syntax trees. |
38 | - `grammar` module is the actual parser. It is a hand-written recursive descent parsers, which | 38 | - `grammar` module is the actual parser. It is a hand-written recursive descent parsers, which |
39 | produced a sequence of events like "start node X", "finish not Y". It works similarly to [kotlin parser](https://github.com/JetBrains/kotlin/blob/4d951de616b20feca92f3e9cc9679b2de9e65195/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinParsing.java), | 39 | produces a sequence of events like "start node X", "finish not Y". It works similarly to [kotlin parser](https://github.com/JetBrains/kotlin/blob/4d951de616b20feca92f3e9cc9679b2de9e65195/compiler/frontend/src/org/jetbrains/kotlin/parsing/KotlinParsing.java), |
40 | which is a good source for inspiration for dealing with syntax errors and incomplete input. Original [libsyntax parser](https://github.com/rust-lang/rust/blob/6b99adeb11313197f409b4f7c4083c2ceca8a4fe/src/libsyntax/parse/parser.rs) | 40 | which is a good source for inspiration for dealing with syntax errors and incomplete input. Original [libsyntax parser](https://github.com/rust-lang/rust/blob/6b99adeb11313197f409b4f7c4083c2ceca8a4fe/src/libsyntax/parse/parser.rs) |
41 | is what we use for the definition of the Rust language. | 41 | is what we use for the definition of the Rust language. |
42 | - `parser_api/parser_impl` bridges the tree-agnostic parser from `grammar` with `rowan` trees. | 42 | - `parser_api/parser_impl` bridges the tree-agnostic parser from `grammar` with `rowan` trees. |
@@ -69,7 +69,7 @@ synchronization and such. | |||
69 | In a sense, `ra_editor` is just a bunch of pure functions which take a | 69 | In a sense, `ra_editor` is just a bunch of pure functions which take a |
70 | syntax tree as an input. | 70 | syntax tree as an input. |
71 | 71 | ||
72 | The tests for `ra_editor` are `[cfg(test)] mod tests` unit-tests spread | 72 | The tests for `ra_editor` are `#[cfg(test)] mod tests` unit-tests spread |
73 | throughout its modules. | 73 | throughout its modules. |
74 | 74 | ||
75 | ### `crates/salsa` | 75 | ### `crates/salsa` |
@@ -104,7 +104,7 @@ A CLI interface to rust-analyzer. | |||
104 | 104 | ||
105 | ### `crate/tools` | 105 | ### `crate/tools` |
106 | 106 | ||
107 | Code-gen tasks, used to develop rust-analyzer: | 107 | Custom Cargo tasks used to develop rust-analyzer: |
108 | 108 | ||
109 | - `cargo gen-kinds` -- generate `ast` and `syntax_kinds` | 109 | - `cargo gen-kinds` -- generate `ast` and `syntax_kinds` |
110 | - `cargo gen-tests` -- collect inline tests from grammar | 110 | - `cargo gen-tests` -- collect inline tests from grammar |
@@ -117,11 +117,17 @@ VS Code plugin | |||
117 | 117 | ||
118 | ## Common workflows | 118 | ## Common workflows |
119 | 119 | ||
120 | To try out VS Code extensions, run `cargo install-code`. To see logs from the language server, | 120 | To try out VS Code extensions, run `cargo install-code`. This installs both the |
121 | set `RUST_LOG=info` env variable. To see all communication between the server and the client, use | 121 | `ra_lsp_server` binary and VS Code extension. To install only the binary, `use |
122 | cargo install --path crates/ra_lsp_server --force` | ||
123 | |||
124 | To see logs from the language server, set `RUST_LOG=info` env variable. To see | ||
125 | all communication between the server and the client, use | ||
122 | `RUST_LOG=gen_lsp_server=debug` (will print quite a bit of stuff). | 126 | `RUST_LOG=gen_lsp_server=debug` (will print quite a bit of stuff). |
123 | 127 | ||
124 | To run tests, just `cargo test`. | 128 | To run tests, just `cargo test`. |
125 | 129 | ||
126 | To work on VS Code extension, launch code inside `editors/code` and use `F5` to launch/debug. | 130 | To work on VS Code extension, launch code inside `editors/code` and use `F5` to |
131 | launch/debug. To automatically apply formatter and linter suggestions, use `npm | ||
132 | run fix`. | ||
127 | 133 | ||