mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-09 03:50:47 +00:00
Correctly build BodySourceMap for macro-expanded expressions
This commit is contained in:
parent
4b51c92fee
commit
9c3b25177e
8 changed files with 129 additions and 72 deletions
|
@ -15,8 +15,9 @@ impl SyntaxNodePtr {
|
|||
SyntaxNodePtr { range: node.text_range(), kind: node.kind() }
|
||||
}
|
||||
|
||||
pub fn to_node(self, parent: &SyntaxNode) -> SyntaxNode {
|
||||
successors(Some(parent.clone()), |node| {
|
||||
pub fn to_node(self, root: &SyntaxNode) -> SyntaxNode {
|
||||
assert!(root.parent().is_none());
|
||||
successors(Some(root.clone()), |node| {
|
||||
node.children().find(|it| self.range.is_subrange(&it.text_range()))
|
||||
})
|
||||
.find(|it| it.text_range() == self.range && it.kind() == self.kind)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue