mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-18 16:20:18 +00:00
grand module rename
This commit is contained in:
parent
93c0b7d794
commit
4cbc902fcc
15 changed files with 0 additions and 0 deletions
|
@ -1,26 +0,0 @@
|
|||
pub mod visit;
|
||||
|
||||
use crate::{SyntaxNode, SyntaxNodeRef, TextRange, TextUnit};
|
||||
|
||||
pub use rowan::LeafAtOffset;
|
||||
|
||||
pub fn find_leaf_at_offset(node: SyntaxNodeRef, offset: TextUnit) -> LeafAtOffset<SyntaxNodeRef> {
|
||||
match node.0.leaf_at_offset(offset) {
|
||||
LeafAtOffset::None => LeafAtOffset::None,
|
||||
LeafAtOffset::Single(n) => LeafAtOffset::Single(SyntaxNode(n)),
|
||||
LeafAtOffset::Between(l, r) => LeafAtOffset::Between(SyntaxNode(l), SyntaxNode(r)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find_covering_node(root: SyntaxNodeRef, range: TextRange) -> SyntaxNodeRef {
|
||||
SyntaxNode(root.0.covering_node(range))
|
||||
}
|
||||
|
||||
pub fn generate<T>(seed: Option<T>, step: impl Fn(&T) -> Option<T>) -> impl Iterator<Item = T> {
|
||||
::itertools::unfold(seed, move |slot| {
|
||||
slot.take().map(|curr| {
|
||||
*slot = step(&curr);
|
||||
curr
|
||||
})
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue