@@ -3,7 +3,7 @@ use ide_db::SymbolKind;
3
3
use syntax:: { ast:: Expr , T } ;
4
4
5
5
use crate :: {
6
- context:: { NameRefContext , PatternContext } ,
6
+ context:: { NameRefContext , NameRefKind , PathCompletionCtx , PathKind , PatternContext } ,
7
7
CompletionContext , CompletionItem , CompletionItemKind , CompletionRelevance ,
8
8
CompletionRelevancePostfixMatch , Completions ,
9
9
} ;
@@ -13,8 +13,18 @@ pub(crate) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) ->
13
13
& ctx. pattern_ctx
14
14
{
15
15
ctx. sema . record_pattern_missing_fields ( record_pat)
16
- } else if let Some ( NameRefContext { record_expr : Some ( ( record_expr, _) ) , .. } ) =
17
- ctx. nameref_ctx ( )
16
+ } else if let Some ( NameRefContext {
17
+ kind :
18
+ Some (
19
+ NameRefKind :: RecordExpr ( record_expr)
20
+ | NameRefKind :: Path ( PathCompletionCtx {
21
+ kind : PathKind :: Expr { is_func_update : Some ( record_expr) , .. } ,
22
+ qualifier : None ,
23
+ ..
24
+ } ) ,
25
+ ) ,
26
+ ..
27
+ } ) = ctx. nameref_ctx ( )
18
28
{
19
29
let ty = ctx. sema . type_of_expr ( & Expr :: RecordExpr ( record_expr. clone ( ) ) ) ;
20
30
@@ -39,7 +49,7 @@ pub(crate) fn complete_record(acc: &mut Completions, ctx: &CompletionContext) ->
39
49
ty. original . impls_trait ( ctx. db , default_trait, & [ ] )
40
50
} ) ;
41
51
42
- if impl_default_trait && !missing_fields. is_empty ( ) && ctx . path_qual ( ) . is_none ( ) {
52
+ if impl_default_trait && !missing_fields. is_empty ( ) {
43
53
let completion_text = "..Default::default()" ;
44
54
let mut item =
45
55
CompletionItem :: new ( SymbolKind :: Field , ctx. source_range ( ) , completion_text) ;
0 commit comments