better comparison
This commit is contained in:
parent
b290285dd8
commit
1811f6330b
@ -482,9 +482,7 @@ fn from_range(parent: ast::StmtList, selected: TextRange) -> FunctionBody {
|
|||||||
let full_body = parent.syntax().children_with_tokens();
|
let full_body = parent.syntax().children_with_tokens();
|
||||||
|
|
||||||
let mut text_range = full_body
|
let mut text_range = full_body
|
||||||
.filter(|it| {
|
.filter(|it| ast::Stmt::can_cast(it.kind()) || it.kind() == COMMENT)
|
||||||
matches!(it.kind().is_punct() || it.kind() == SyntaxKind::WHITESPACE, false)
|
|
||||||
})
|
|
||||||
.map(|element| element.text_range())
|
.map(|element| element.text_range())
|
||||||
.filter(|&range| selected.intersect(range).filter(|it| !it.is_empty()).is_some())
|
.filter(|&range| selected.intersect(range).filter(|it| !it.is_empty()).is_some())
|
||||||
.reduce(|acc, stmt| acc.cover(stmt));
|
.reduce(|acc, stmt| acc.cover(stmt));
|
||||||
|
Loading…
Reference in New Issue
Block a user