mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
flip comma
This commit is contained in:
parent
56aa6e20e0
commit
66be735aa9
12 changed files with 273 additions and 57 deletions
|
@ -101,6 +101,17 @@ impl<R: TreeRoot> SyntaxNode<R> {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn prev_sibling(&self) -> Option<SyntaxNode<R>> {
|
||||
let red = self.red();
|
||||
let parent = self.parent()?;
|
||||
let prev_sibling_idx = red.index_in_parent()?.checked_sub(1)?;
|
||||
let sibling_red = parent.red().get_child(prev_sibling_idx)?;
|
||||
Some(SyntaxNode {
|
||||
root: self.root.clone(),
|
||||
red: sibling_red,
|
||||
})
|
||||
}
|
||||
|
||||
pub fn is_leaf(&self) -> bool {
|
||||
self.first_child().is_none()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue