@@ -24,7 +24,7 @@ pub(crate) struct CompletionContext<'a> {
24
24
pub ( super ) original_token : SyntaxToken ,
25
25
/// The token before the cursor, in the macro-expanded file.
26
26
pub ( super ) token : SyntaxToken ,
27
- pub ( super ) module : Option < hir:: Module > ,
27
+ pub ( super ) krate : Option < hir:: Crate > ,
28
28
pub ( super ) name_ref_syntax : Option < ast:: NameRef > ,
29
29
pub ( super ) function_syntax : Option < ast:: FnDef > ,
30
30
pub ( super ) use_item_syntax : Option < ast:: UseItem > ,
@@ -73,8 +73,7 @@ impl<'a> CompletionContext<'a> {
73
73
let fake_ident_token =
74
74
file_with_fake_ident. syntax ( ) . token_at_offset ( position. offset ) . right_biased ( ) . unwrap ( ) ;
75
75
76
- // TODO: shouldn't this take the position into account? (in case we're inside a mod {})
77
- let module = sema. to_module_def ( position. file_id ) ;
76
+ let krate = sema. to_module_def ( position. file_id ) . map ( |m| m. krate ( ) ) ;
78
77
let original_token =
79
78
original_file. syntax ( ) . token_at_offset ( position. offset ) . left_biased ( ) ?;
80
79
let token = sema. descend_into_macros ( original_token. clone ( ) ) ;
@@ -84,7 +83,7 @@ impl<'a> CompletionContext<'a> {
84
83
original_token,
85
84
token,
86
85
offset : position. offset ,
87
- module ,
86
+ krate ,
88
87
name_ref_syntax : None ,
89
88
function_syntax : None ,
90
89
use_item_syntax : None ,
@@ -132,7 +131,6 @@ impl<'a> CompletionContext<'a> {
132
131
if new_offset >= actual_expansion. text_range ( ) . end ( ) {
133
132
break ;
134
133
}
135
- // TODO check that the expansions 'look the same' up to the inserted token?
136
134
original_file = actual_expansion;
137
135
hypothetical_file = hypothetical_expansion. 0 ;
138
136
fake_ident_token = hypothetical_expansion. 1 ;
0 commit comments