Complete associated types in dyn and impl trait

This commit is contained in:
Lukas Wirth 2021-06-11 23:12:30 +02:00
parent 863e23f00f
commit ec9ef9c283
4 changed files with 64 additions and 10 deletions

View file

@ -47,6 +47,9 @@ pub(crate) enum ImmediateLocation {
receiver_is_ambiguous_float_literal: bool,
},
// Original file ast node
// Only set from a type arg
GenericArgList(ast::GenericArgList),
// Original file ast node
/// The record expr of the field name we are completing
RecordExpr(ast::RecordExpr),
// Original file ast node
@ -159,7 +162,6 @@ pub(crate) fn determine_location(
}
}
};
let res = match_ast! {
match parent {
ast::IdentPat(_it) => ImmediateLocation::IdentPat,
@ -174,6 +176,9 @@ pub(crate) fn determine_location(
Some(TRAIT) => ImmediateLocation::Trait,
_ => return None,
},
ast::GenericArgList(_it) => sema
.find_node_at_offset_with_macros(original_file, offset)
.map(ImmediateLocation::GenericArgList)?,
ast::Module(it) => {
if it.item_list().is_none() {
ImmediateLocation::ModDeclaration(it)