mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
make grammar independent of syntax tree
This commit is contained in:
parent
1b2e70df99
commit
cd0d2866fc
2 changed files with 18 additions and 14 deletions
|
@ -83,7 +83,11 @@ fn find_reparsable_node(
|
|||
range: TextRange,
|
||||
) -> Option<(&SyntaxNode, fn(&mut Parser))> {
|
||||
let node = algo::find_covering_node(node, range);
|
||||
node.ancestors().find_map(|node| grammar::reparser(node).map(|r| (node, r)))
|
||||
node.ancestors().find_map(|node| {
|
||||
let first_child = node.first_child().map(|it| it.kind());
|
||||
let parent = node.parent().map(|it| it.kind());
|
||||
grammar::reparser(node.kind(), first_child, parent).map(|r| (node, r))
|
||||
})
|
||||
}
|
||||
|
||||
fn is_balanced(tokens: &[Token]) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue