mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
fix: Hide dyn inlay hints for incomplete impl
s
This commit is contained in:
parent
6acff6c1f8
commit
4cf958cfd4
@ -22,9 +22,14 @@ pub(super) fn hints(
|
|||||||
let parent = paren.as_ref().and_then(|it| it.parent()).unwrap_or(parent);
|
let parent = paren.as_ref().and_then(|it| it.parent()).unwrap_or(parent);
|
||||||
if ast::TypeBound::can_cast(parent.kind())
|
if ast::TypeBound::can_cast(parent.kind())
|
||||||
|| ast::TypeAnchor::can_cast(parent.kind())
|
|| ast::TypeAnchor::can_cast(parent.kind())
|
||||||
|| ast::Impl::cast(parent)
|
|| ast::Impl::cast(parent).is_some_and(|it| {
|
||||||
.and_then(|it| it.trait_())
|
it.trait_().map_or(
|
||||||
.is_some_and(|it| it.syntax() == path.syntax())
|
// only show it for impl type if the impl is not incomplete, otherwise we
|
||||||
|
// are likely typing a trait impl
|
||||||
|
it.assoc_item_list().is_none_or(|it| it.l_curly_token().is_none()),
|
||||||
|
|trait_| trait_.syntax() == path.syntax(),
|
||||||
|
)
|
||||||
|
})
|
||||||
{
|
{
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
@ -85,6 +90,7 @@ impl T {}
|
|||||||
// ^ dyn
|
// ^ dyn
|
||||||
impl T for (T) {}
|
impl T for (T) {}
|
||||||
// ^^^ dyn
|
// ^^^ dyn
|
||||||
|
impl T
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user