@@ -74,8 +74,8 @@ to study its methods to understand all the input data.
7474[ `Change` ] : https://github.com/rust-lang/rust-analyzer/blob/2024-01-01/crates/hir-expand/src/change.rs#L10-L42
7575[ `FileChange` ] : https://github.com/rust-lang/rust-analyzer/blob/2024-01-01/crates/base-db/src/change.rs#L14-L78
7676
77- The ` change_file ` methods controls the set of the input files, where each file
78- has an integer id (` FileId ` , picked by the client), text (` Option<Arc<str>> ` ).
77+ The ` change_file ` method controls the set of the input files, where each file
78+ has an integer id (` FileId ` , picked by the client) and text (` Option<Arc<str>> ` ).
7979Paths are tricky; they'll be explained below, in source roots section,
8080together with the ` set_roots ` method. The "source root" [ ` is_library ` ] flag
8181along with the concept of [ ` durability ` ] allows us to add a group of files which
@@ -397,7 +397,7 @@ the `foo` function of the `bar` `impl` in the `baz` module").
397397
398398[ ` Intern ` and ` Lookup ` ] traits allows us to combine the benefits of positional and numeric
399399IDs. Implementing both traits effectively creates a bidirectional append-only map
400- between locations and integer IDs (typically newtype wrappers of [ ` salsa::InternId ` ] )
400+ between locations and integer IDs (typically newtype wrappers for [ ` salsa::InternId ` ] )
401401which can "intern" a location and return an integer ID back. The salsa database we use
402402includes a couple of [ interners] . How to "garbage collect" unused locations
403403is an open question.
@@ -552,9 +552,10 @@ completion] and serialize results into the LSP.
552552The [ completion implementation] is finally the place where we start doing the actual
553553work. The first step is to collect the [ ` CompletionContext ` ] -- a struct which
554554describes the cursor position in terms of Rust syntax and semantics. For
555- example, ` function_syntax: Option<&'a ast::FnDef> ` stores a reference to
556- the enclosing function * syntax* , while ` function: Option<hir::Function> ` is the
557- ` Def ` for this function.
555+ example, ` expected_name: Option<NameOrNameRef> ` is the syntactic representation
556+ for the expected name of what we're completing (usually the parameter name of
557+ a function argument), while ` expected_type: Option<Type> ` is the semantic model
558+ for the expected type of what we're completing.
558559
559560To construct the context, we first do an [ "IntelliJ Trick"] : we insert a dummy
560561identifier at the cursor's position and parse this modified file, to get a
0 commit comments