diff options
-rw-r--r-- | crates/base_db/src/change.rs | 2 | ||||
-rw-r--r-- | crates/ide_db/src/apply_change.rs | 2 | ||||
-rw-r--r-- | crates/ide_db/src/source_change.rs | 2 | ||||
-rw-r--r-- | docs/dev/guide.md | 10 |
4 files changed, 8 insertions, 8 deletions
diff --git a/crates/base_db/src/change.rs b/crates/base_db/src/change.rs index 043e03bba..04e294e41 100644 --- a/crates/base_db/src/change.rs +++ b/crates/base_db/src/change.rs | |||
@@ -19,7 +19,7 @@ pub struct Change { | |||
19 | 19 | ||
20 | impl fmt::Debug for Change { | 20 | impl fmt::Debug for Change { |
21 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | 21 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
22 | let mut d = fmt.debug_struct("AnalysisChange"); | 22 | let mut d = fmt.debug_struct("Change"); |
23 | if let Some(roots) = &self.roots { | 23 | if let Some(roots) = &self.roots { |
24 | d.field("roots", roots); | 24 | d.field("roots", roots); |
25 | } | 25 | } |
diff --git a/crates/ide_db/src/apply_change.rs b/crates/ide_db/src/apply_change.rs index 23974cff8..104ee113f 100644 --- a/crates/ide_db/src/apply_change.rs +++ b/crates/ide_db/src/apply_change.rs | |||
@@ -32,7 +32,7 @@ struct RootChange { | |||
32 | 32 | ||
33 | impl fmt::Debug for RootChange { | 33 | impl fmt::Debug for RootChange { |
34 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | 34 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { |
35 | fmt.debug_struct("AnalysisChange") | 35 | fmt.debug_struct("RootChange") |
36 | .field("added", &self.added.len()) | 36 | .field("added", &self.added.len()) |
37 | .field("removed", &self.removed.len()) | 37 | .field("removed", &self.removed.len()) |
38 | .finish() | 38 | .finish() |
diff --git a/crates/ide_db/src/source_change.rs b/crates/ide_db/src/source_change.rs index f76bac151..b36455d49 100644 --- a/crates/ide_db/src/source_change.rs +++ b/crates/ide_db/src/source_change.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! This modules defines type to represent changes to the source code, that flow | 1 | //! This modules defines type to represent changes to the source code, that flow |
2 | //! from the server to the client. | 2 | //! from the server to the client. |
3 | //! | 3 | //! |
4 | //! It can be viewed as a dual for `AnalysisChange`. | 4 | //! It can be viewed as a dual for `Change`. |
5 | 5 | ||
6 | use std::{ | 6 | use std::{ |
7 | collections::hash_map::Entry, | 7 | collections::hash_map::Entry, |
diff --git a/docs/dev/guide.md b/docs/dev/guide.md index b5a5d7c93..c1a55c56c 100644 --- a/docs/dev/guide.md +++ b/docs/dev/guide.md | |||
@@ -65,11 +65,11 @@ Next, let's talk about what the inputs to the `Analysis` are, precisely. | |||
65 | 65 | ||
66 | Rust Analyzer never does any I/O itself, all inputs get passed explicitly via | 66 | Rust Analyzer never does any I/O itself, all inputs get passed explicitly via |
67 | the `AnalysisHost::apply_change` method, which accepts a single argument, a | 67 | the `AnalysisHost::apply_change` method, which accepts a single argument, a |
68 | `AnalysisChange`. [`AnalysisChange`] is a builder for a single change | 68 | `Change`. [`Change`] is a builder for a single change |
69 | "transaction", so it suffices to study its methods to understand all of the | 69 | "transaction", so it suffices to study its methods to understand all of the |
70 | input data. | 70 | input data. |
71 | 71 | ||
72 | [`AnalysisChange`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ide_api/src/lib.rs#L119-L167 | 72 | [`Change`]: https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/base_db/src/change.rs#L14-L89 |
73 | 73 | ||
74 | The `(add|change|remove)_file` methods control the set of the input files, where | 74 | The `(add|change|remove)_file` methods control the set of the input files, where |
75 | each file has an integer id (`FileId`, picked by the client), text (`String`) | 75 | each file has an integer id (`FileId`, picked by the client), text (`String`) |
@@ -158,7 +158,7 @@ it should be possible to dynamically reconfigure it later without restart. | |||
158 | [main_loop.rs#L62-L70](https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L62-L70) | 158 | [main_loop.rs#L62-L70](https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L62-L70) |
159 | 159 | ||
160 | The [`ProjectModel`] we get after this step is very Cargo and sysroot specific, | 160 | The [`ProjectModel`] we get after this step is very Cargo and sysroot specific, |
161 | it needs to be lowered to get the input in the form of `AnalysisChange`. This | 161 | it needs to be lowered to get the input in the form of `Change`. This |
162 | happens in [`ServerWorldState::new`] method. Specifically | 162 | happens in [`ServerWorldState::new`] method. Specifically |
163 | 163 | ||
164 | * Create a `SourceRoot` for each Cargo package and sysroot. | 164 | * Create a `SourceRoot` for each Cargo package and sysroot. |
@@ -175,7 +175,7 @@ of the main loop, just like any other change. Here's where we handle: | |||
175 | * [File system changes](https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L194) | 175 | * [File system changes](https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L194) |
176 | * [Changes from the editor](https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L377) | 176 | * [Changes from the editor](https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L377) |
177 | 177 | ||
178 | After a single loop's turn, we group the changes into one `AnalysisChange` and | 178 | After a single loop's turn, we group the changes into one `Change` and |
179 | [apply] it. This always happens on the main thread and blocks the loop. | 179 | [apply] it. This always happens on the main thread and blocks the loop. |
180 | 180 | ||
181 | [apply]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/server_world.rs#L216 | 181 | [apply]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/server_world.rs#L216 |
@@ -256,7 +256,7 @@ database. | |||
256 | [`RootDatabase`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ide_api/src/db.rs#L88-L134 | 256 | [`RootDatabase`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/ide_api/src/db.rs#L88-L134 |
257 | 257 | ||
258 | Salsa input queries are defined in [`FilesDatabase`] (which is a part of | 258 | Salsa input queries are defined in [`FilesDatabase`] (which is a part of |
259 | `RootDatabase`). They closely mirror the familiar `AnalysisChange` structure: | 259 | `RootDatabase`). They closely mirror the familiar `Change` structure: |
260 | indeed, what `apply_change` does is it sets the values of input queries. | 260 | indeed, what `apply_change` does is it sets the values of input queries. |
261 | 261 | ||
262 | [`FilesDatabase`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/base_db/src/input.rs#L150-L174 | 262 | [`FilesDatabase`]: https://github.com/rust-analyzer/rust-analyzer/blob/guide-2019-01/crates/base_db/src/input.rs#L150-L174 |