aboutsummaryrefslogtreecommitdiff
path: root/docs/dev/architecture.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/dev/architecture.md')
-rw-r--r--docs/dev/architecture.md24
1 files changed, 12 insertions, 12 deletions
diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md
index d0c6eea61..6f1377f2f 100644
--- a/docs/dev/architecture.md
+++ b/docs/dev/architecture.md
@@ -56,7 +56,7 @@ In particular, `cargo xtask codegen` generates:
562. [`ast/generated`](https://github.com/rust-analyzer/rust-analyzer/blob/a0be39296d2925972cacd9fbf8b5fb258fad6947/crates/ra_syntax/src/ast/generated.rs) 562. [`ast/generated`](https://github.com/rust-analyzer/rust-analyzer/blob/a0be39296d2925972cacd9fbf8b5fb258fad6947/crates/ra_syntax/src/ast/generated.rs)
57 -- AST data structure. 57 -- AST data structure.
58 58
593. [`doc_tests/generated`](https://github.com/rust-analyzer/rust-analyzer/blob/a0be39296d2925972cacd9fbf8b5fb258fad6947/crates/ra_assists/src/doc_tests/generated.rs), 593. [`doc_tests/generated`](https://github.com/rust-analyzer/rust-analyzer/blob/a0be39296d2925972cacd9fbf8b5fb258fad6947/crates/assists/src/doc_tests/generated.rs),
60 [`test_data/parser/inline`](https://github.com/rust-analyzer/rust-analyzer/tree/a0be39296d2925972cacd9fbf8b5fb258fad6947/crates/ra_syntax/test_data/parser/inline) 60 [`test_data/parser/inline`](https://github.com/rust-analyzer/rust-analyzer/tree/a0be39296d2925972cacd9fbf8b5fb258fad6947/crates/ra_syntax/test_data/parser/inline)
61 -- tests for assists and the parser. 61 -- tests for assists and the parser.
62 62
@@ -64,7 +64,7 @@ The source for 1 and 2 is in [`ast_src.rs`](https://github.com/rust-analyzer/rus
64 64
65## Code Walk-Through 65## Code Walk-Through
66 66
67### `crates/ra_syntax`, `crates/ra_parser` 67### `crates/ra_syntax`, `crates/parser`
68 68
69Rust syntax tree structure and parser. See 69Rust syntax tree structure and parser. See
70[RFC](https://github.com/rust-lang/rfcs/pull/2256) and [./syntax.md](./syntax.md) for some design notes. 70[RFC](https://github.com/rust-lang/rfcs/pull/2256) and [./syntax.md](./syntax.md) for some design notes.
@@ -92,17 +92,17 @@ in particular: it shows off various methods of working with syntax tree.
92See [#93](https://github.com/rust-analyzer/rust-analyzer/pull/93) for an example PR which 92See [#93](https://github.com/rust-analyzer/rust-analyzer/pull/93) for an example PR which
93fixes a bug in the grammar. 93fixes a bug in the grammar.
94 94
95### `crates/ra_db` 95### `crates/base_db`
96 96
97We use the [salsa](https://github.com/salsa-rs/salsa) crate for incremental and 97We use the [salsa](https://github.com/salsa-rs/salsa) crate for incremental and
98on-demand computation. Roughly, you can think of salsa as a key-value store, but 98on-demand computation. Roughly, you can think of salsa as a key-value store, but
99it also can compute derived values using specified functions. The `ra_db` crate 99it also can compute derived values using specified functions. The `base_db` crate
100provides basic infrastructure for interacting with salsa. Crucially, it 100provides basic infrastructure for interacting with salsa. Crucially, it
101defines most of the "input" queries: facts supplied by the client of the 101defines most of the "input" queries: facts supplied by the client of the
102analyzer. Reading the docs of the `ra_db::input` module should be useful: 102analyzer. Reading the docs of the `base_db::input` module should be useful:
103everything else is strictly derived from those inputs. 103everything else is strictly derived from those inputs.
104 104
105### `crates/ra_hir*` crates 105### `crates/hir*` crates
106 106
107HIR provides high-level "object oriented" access to Rust code. 107HIR provides high-level "object oriented" access to Rust code.
108 108
@@ -113,12 +113,12 @@ is responsible for guessing a HIR for a particular source position.
113 113
114Underneath, HIR works on top of salsa, using a `HirDatabase` trait. 114Underneath, HIR works on top of salsa, using a `HirDatabase` trait.
115 115
116`ra_hir_xxx` crates have a strong ECS flavor, in that they work with raw ids and 116`hir_xxx` crates have a strong ECS flavor, in that they work with raw ids and
117directly query the database. 117directly query the database.
118 118
119The top-level `ra_hir` façade crate wraps ids into a more OO-flavored API. 119The top-level `hir` façade crate wraps ids into a more OO-flavored API.
120 120
121### `crates/ra_ide` 121### `crates/ide`
122 122
123A stateful library for analyzing many Rust files as they change. `AnalysisHost` 123A stateful library for analyzing many Rust files as they change. `AnalysisHost`
124is a mutable entity (clojure's atom) which holds the current state, incorporates 124is a mutable entity (clojure's atom) which holds the current state, incorporates
@@ -136,11 +136,11 @@ offsets and strings as output. This works on top of rich code model powered by
136 136
137### `crates/rust-analyzer` 137### `crates/rust-analyzer`
138 138
139An LSP implementation which wraps `ra_ide` into a language server protocol. 139An LSP implementation which wraps `ide` into a language server protocol.
140 140
141### `ra_vfs` 141### `ra_vfs`
142 142
143Although `hir` and `ra_ide` don't do any IO, we need to be able to read 143Although `hir` and `ide` don't do any IO, we need to be able to read
144files from disk at the end of the day. This is what `ra_vfs` does. It also 144files from disk at the end of the day. This is what `ra_vfs` does. It also
145manages overlays: "dirty" files in the editor, whose "true" contents is 145manages overlays: "dirty" files in the editor, whose "true" contents is
146different from data on disk. This is more or less the single really 146different from data on disk. This is more or less the single really
@@ -161,7 +161,7 @@ disk. For this reason, we try to avoid writing too many tests on this boundary:
161in a statically typed language, it's hard to make an error in the protocol 161in a statically typed language, it's hard to make an error in the protocol
162itself if messages are themselves typed. 162itself if messages are themselves typed.
163 163
164The middle, and most important, boundary is `ra_ide`. Unlike 164The middle, and most important, boundary is `ide`. Unlike
165`rust-analyzer`, which exposes API, `ide` uses Rust API and is intended to 165`rust-analyzer`, which exposes API, `ide` uses Rust API and is intended to
166use by various tools. Typical test creates an `AnalysisHost`, calls some 166use by various tools. Typical test creates an `AnalysisHost`, calls some
167`Analysis` functions and compares the results against expectation. 167`Analysis` functions and compares the results against expectation.