@@ -74,8 +74,8 @@ to study its methods to understand all the input data.
74
74
[ `Change` ] : https://github.com/rust-lang/rust-analyzer/blob/2024-01-01/crates/hir-expand/src/change.rs#L10-L42
75
75
[ `FileChange` ] : https://github.com/rust-lang/rust-analyzer/blob/2024-01-01/crates/base-db/src/change.rs#L14-L78
76
76
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>> ` ).
79
79
Paths are tricky; they'll be explained below, in source roots section,
80
80
together with the ` set_roots ` method. The "source root" [ ` is_library ` ] flag
81
81
along 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").
397
397
398
398
[ ` Intern ` and ` Lookup ` ] traits allows us to combine the benefits of positional and numeric
399
399
IDs. 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 ` ] )
401
401
which can "intern" a location and return an integer ID back. The salsa database we use
402
402
includes a couple of [ interners] . How to "garbage collect" unused locations
403
403
is an open question.
@@ -552,9 +552,10 @@ completion] and serialize results into the LSP.
552
552
The [ completion implementation] is finally the place where we start doing the actual
553
553
work. The first step is to collect the [ ` CompletionContext ` ] -- a struct which
554
554
describes 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.
558
559
559
560
To construct the context, we first do an [ "IntelliJ Trick"] : we insert a dummy
560
561
identifier at the cursor's position and parse this modified file, to get a
0 commit comments