aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-12-17 20:23:39 +0000
committerAleksey Kladov <[email protected]>2018-12-17 20:23:44 +0000
commit00b71e668d067f60c0ba966afba75ba4adda83eb (patch)
treed706601793422cf511d73caa960a1313a8f3a6ac
parent1875aa024f885f1d6119bff8aa828634b4941248 (diff)
update architecture.md
-rw-r--r--ARCHITECTURE.md46
1 files changed, 27 insertions, 19 deletions
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index a6b1bf873..d920ce2ab 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -58,27 +58,25 @@ all `//test test_name` comments into files inside `tests/data` directory.
58See [#93](https://github.com/rust-analyzer/rust-analyzer/pull/93) for an example PR which 58See [#93](https://github.com/rust-analyzer/rust-analyzer/pull/93) for an example PR which
59fixes a bug in the grammar. 59fixes a bug in the grammar.
60 60
61### `crates/ra_hir` 61### `crates/ra_db`
62
63HIR (previsouly known as descriptors) provides a high-level OO acess to Rust
64code.
65 62
66The principal difference between HIR and syntax trees is that HIR is bound 63We use [salsa][https://github.com/salsa-rs/salsa] crate for incremental and
67to a particular crate instance. That is, it has cfg flags and features 64on-demand computation. Roughly, you can think of salsa as a key-value store, but
68applied. So, there relation between syntax and HIR is many-to-one. 65it also can compute derived values using specified functions. The `ra_db` crate
66provides a basic infrastructure for interracting with salsa. Crucially, it
67defines most of the "input" queries: facts supplied by the client of the analyzer.
69 68
70### `crates/ra_editor` 69### `crates/ra_hir`
71 70
72All IDE features which can be implemented if you only have access to a 71HIR provides a high-level "object oriented" acess to Rust code.
73single file. `ra_editor` could be used to enhance editing of Rust code
74without the need to fiddle with build-systems, file
75synchronization and such.
76 72
77In a sense, `ra_editor` is just a bunch of pure functions which take a 73The principal difference between HIR and syntax trees is that HIR is bound to a
78syntax tree as an input. 74particular crate instance. That is, it has cfg flags and features applied (in
75theory, in practice this is to be implemented). So, there relation between
76syntax and HIR is many-to-one. The `source_binder` modules is responsible for
77guessing a hir for a particular source position.
79 78
80The tests for `ra_editor` are `#[cfg(test)] mod tests` unit-tests spread 79Underneath, hir works on top of salsa, using a `HirDatabase` trait.
81throughout its modules.
82 80
83### `crates/ra_analysis` 81### `crates/ra_analysis`
84 82
@@ -88,9 +86,6 @@ current state, incorporates changes and handles out `Analysis` --- an
88immutable consistent snapshot of world state at a point in time, which 86immutable consistent snapshot of world state at a point in time, which
89actually powers analysis. 87actually powers analysis.
90 88
91### `crates/ra_db`
92This defines basic database traits. Concrete DB is defined by ra_analysis.
93
94### `crates/ra_lsp_server` 89### `crates/ra_lsp_server`
95 90
96An LSP implementation which uses `ra_analysis` for managing state and 91An LSP implementation which uses `ra_analysis` for managing state and
@@ -100,6 +95,19 @@ See [#79](https://github.com/rust-analyzer/rust-analyzer/pull/79/) as an
100example of PR which adds a new feature to `ra_editor` and exposes it 95example of PR which adds a new feature to `ra_editor` and exposes it
101to `ra_lsp_server`. 96to `ra_lsp_server`.
102 97
98### `crates/ra_editor`
99
100All IDE features which can be implemented if you only have access to a
101single file. `ra_editor` could be used to enhance editing of Rust code
102without the need to fiddle with build-systems, file
103synchronization and such.
104
105In a sense, `ra_editor` is just a bunch of pure functions which take a
106syntax tree as an input.
107
108The tests for `ra_editor` are `#[cfg(test)] mod tests` unit-tests spread
109throughout its modules.
110
103### `crates/gen_lsp_server` 111### `crates/gen_lsp_server`
104 112
105A language server scaffold, exposing a synchronous crossbeam-channel based API. 113A language server scaffold, exposing a synchronous crossbeam-channel based API.