Simplify
This commit is contained in:
@@ -242,13 +242,9 @@ fn replacement_range(ctx: &CompletionContext, item: &SyntaxNode) -> TextRange {
|
|||||||
let first_child = item
|
let first_child = item
|
||||||
.children_with_tokens()
|
.children_with_tokens()
|
||||||
.find(|child| {
|
.find(|child| {
|
||||||
let kind = child.kind();
|
!matches!(child.kind(), SyntaxKind::COMMENT | SyntaxKind::WHITESPACE | SyntaxKind::ATTR)
|
||||||
match kind {
|
|
||||||
SyntaxKind::COMMENT | SyntaxKind::WHITESPACE | SyntaxKind::ATTR => false,
|
|
||||||
_ => true,
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.unwrap_or(SyntaxElement::Node(item.clone()));
|
.unwrap_or_else(|| SyntaxElement::Node(item.clone()));
|
||||||
|
|
||||||
TextRange::new(first_child.text_range().start(), ctx.source_range().end())
|
TextRange::new(first_child.text_range().start(), ctx.source_range().end())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user