mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-27 10:17:15 +00:00
internal: Restructure some semantics APIs for virtual macro files
This commit is contained in:
parent
f0e39c77cc
commit
38bf4b1fe1
12 changed files with 185 additions and 79 deletions
|
|
@ -5,6 +5,7 @@
|
|||
use std::{mem, ops::RangeInclusive};
|
||||
|
||||
use parser::T;
|
||||
use rowan::TextSize;
|
||||
|
||||
use crate::{
|
||||
SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken,
|
||||
|
|
@ -74,6 +75,12 @@ impl Position {
|
|||
};
|
||||
Position { repr }
|
||||
}
|
||||
pub fn offset(&self) -> TextSize {
|
||||
match &self.repr {
|
||||
PositionRepr::FirstChild(node) => node.text_range().start(),
|
||||
PositionRepr::After(elem) => elem.text_range().end(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn insert(position: Position, elem: impl Element) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue