Pick smaller node ancestors first when descending at offset

This commit is contained in:
Lukas Wirth 2021-09-14 14:09:52 +02:00
parent 538ac599d2
commit d1e489185f
2 changed files with 18 additions and 5 deletions

View file

@ -525,7 +525,7 @@ impl InFile<SyntaxNode> {
pub fn ancestors_with_macros(
self,
db: &dyn db::AstDatabase,
) -> impl Iterator<Item = InFile<SyntaxNode>> + '_ {
) -> impl Iterator<Item = InFile<SyntaxNode>> + Clone + '_ {
iter::successors(Some(self), move |node| match node.value.parent() {
Some(parent) => Some(node.with_value(parent)),
None => {