@@ -65,11 +65,11 @@ Next, let's talk about what the inputs to the `Analysis` are, precisely.
6565
6666rust-analyzer never does any I/O itself, all inputs get passed explicitly via
6767the ` AnalysisHost::apply_change ` method, which accepts a single argument, a
68- ` Change ` . [ ` Change ` ] is a builder for a single change
68+ ` AnalysisChange ` . [ ` AnalysisChange ` ] is a builder for a single change
6969"transaction", so it suffices to study its methods to understand all of the
7070input data.
7171
72- [ `Change ` ] : https://github.com/rust-lang/rust-analyzer/blob/master /crates/base_db /src/change .rs#L14-L89
72+ [ `AnalysisChange ` ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01 /crates/ra_ide_api /src/lib .rs#L119-L167
7373
7474The ` (add|change|remove)_file ` methods control the set of the input files, where
7575each file has an integer id (` FileId ` , picked by the client), text (` String ` )
@@ -118,7 +118,7 @@ can have `#[path="/dev/random"] mod foo;`.
118118
119119To solve (or explicitly refuse to solve) these problems rust-analyzer uses the
120120concept of a "source root". Roughly speaking, source roots are the contents of a
121- directory on a file systems , like ` /home/matklad/projects/rustraytracer/**.rs ` .
121+ directory on a file system , like ` /home/matklad/projects/rustraytracer/**.rs ` .
122122
123123More precisely, all files (` FileId ` s) are partitioned into disjoint
124124` SourceRoot ` s. Each file has a relative UTF-8 path within the ` SourceRoot ` .
@@ -156,7 +156,7 @@ it should be possible to dynamically reconfigure it later without restart.
156156[ main_loop.rs#L62-L70] ( https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L62-L70 )
157157
158158The [ ` ProjectModel ` ] we get after this step is very Cargo and sysroot specific,
159- it needs to be lowered to get the input in the form of ` Change ` . This
159+ it needs to be lowered to get the input in the form of ` AnalysisChange ` . This
160160happens in [ ` ServerWorldState::new ` ] method. Specifically
161161
162162* Create a ` SourceRoot ` for each Cargo package and sysroot.
@@ -173,7 +173,7 @@ of the main loop, just like any other change. Here's where we handle:
173173* [ File system changes] ( https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L194 )
174174* [ Changes from the editor] ( https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L377 )
175175
176- After a single loop's turn, we group the changes into one ` Change ` and
176+ After a single loop's turn, we group the changes into one ` AnalysisChange ` and
177177[ apply] it. This always happens on the main thread and blocks the loop.
178178
179179[ apply ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/server_world.rs#L216
@@ -186,7 +186,7 @@ executing "goto definition" on the threadpool and a new change comes in, the
186186task will be canceled as soon as the main loop calls ` apply_change ` on the
187187` AnalysisHost ` .
188188
189- [ "goto definition" ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/server_world .rs#L216
189+ [ "goto definition" ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop .rs#L296
190190[ `schedule` ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L426-L455
191191[ The task ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop/handlers.rs#L205-L223
192192
@@ -250,13 +250,13 @@ All analyzer information is stored in a salsa database. `Analysis` and
250250` AnalysisHost ` types are newtype wrappers for [ ` RootDatabase ` ] -- a salsa
251251database.
252252
253- [ `RootDatabase` ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ide_api /src/db.rs#L88-L134
253+ [ `RootDatabase` ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api /src/db.rs#L88-L134
254254
255255Salsa input queries are defined in [ ` FilesDatabase ` ] (which is a part of
256- ` RootDatabase ` ). They closely mirror the familiar ` Change ` structure:
256+ ` RootDatabase ` ). They closely mirror the familiar ` AnalysisChange ` structure:
257257indeed, what ` apply_change ` does is it sets the values of input queries.
258258
259- [ `FilesDatabase` ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/base_db /src/input.rs#L150-L174
259+ [ `FilesDatabase` ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_db /src/input.rs#L150-L174
260260
261261## From text to semantic model
262262
@@ -281,7 +281,7 @@ methods invoke various queries on the database to build the model on demand.
281281Here's [ the list of queries] .
282282
283283[ `code_model_api` ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/code_model_api.rs
284- [ the list of queries ] : https://github.com/rust-lang/rust-analyzer/blob/7e84440e25e19529e4ff8a66e521d1b06349c6ec /crates/ra_hir/src/db.rs#L20-L106
284+ [ the list of queries ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01 /crates/ra_hir/src/db.rs#L20-L106
285285
286286The first step of building the model is parsing the source code.
287287
@@ -493,7 +493,7 @@ position-independent part of the lowering. The result of this query is stable.
493493Naturally, name resolution [ uses] this stable projection query.
494494
495495[ imports ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/nameres/lower.rs#L52-L59
496- [ `SourceMap` ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/nameres/lower.rs#L52-L59
496+ [ `SourceMap` ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/nameres/lower.rs#L74-L94
497497[ projection query ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/nameres/lower.rs#L97-L103
498498[ uses ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_hir/src/query_definitions.rs#L49
499499
@@ -560,8 +560,7 @@ the type to completion.
560560[ receiving a message ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L203
561561[ schedule it on the threadpool ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L428
562562[ catch ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop.rs#L436-L442
563- [ the handler ] : https://salsa.zulipchat.com/#narrow/stream/181542-rfcs.2Fsalsa-query-group/topic/design.20next.20steps
564- [ ask analysis for completion ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ide_api/src/lib.rs#L439-L444
563+ [ the handler ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_lsp_server/src/main_loop/handlers.rs#L304-L343
565564[ ask analysis for completion ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/lib.rs#L439-L444
566565[ completion implementation ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/completion.rs#L46-L62
567566[ `CompletionContext` ] : https://github.com/rust-lang/rust-analyzer/blob/guide-2019-01/crates/ra_ide_api/src/completion/completion_context.rs#L14-L37
0 commit comments