Refine functional update completion some more

This commit is contained in:
Lukas Wirth 2021-08-10 17:03:38 +02:00
parent e1dcec0e02
commit f6d6fda85b
3 changed files with 40 additions and 7 deletions

View file

@ -63,6 +63,9 @@ pub(crate) enum ImmediateLocation {
/// The record expr of the field name we are completing
RecordExpr(ast::RecordExpr),
// Original file ast node
/// The record expr of the functional update syntax we are completing
RecordExprUpdate(ast::RecordExpr),
// Original file ast node
/// The record pat of the field name we are completing
RecordPat(ast::RecordPat),
}
@ -209,7 +212,7 @@ pub(crate) fn determine_location(
},
ast::RecordExprFieldList(_it) => sema
.find_node_at_offset_with_macros(original_file, offset)
.map(ImmediateLocation::RecordExpr)?,
.map(ImmediateLocation::RecordExprUpdate)?,
ast::TupleField(_it) => ImmediateLocation::TupleField,
ast::TupleFieldList(_it) => ImmediateLocation::TupleField,
ast::TypeBound(_it) => ImmediateLocation::TypeBound,