mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Convert code to text-size
This commit is contained in:
parent
27a7718880
commit
b1d5817dd1
75 changed files with 438 additions and 456 deletions
|
@ -55,7 +55,7 @@ pub use crate::{
|
|||
},
|
||||
};
|
||||
pub use ra_parser::{SyntaxKind, T};
|
||||
pub use rowan::{SmolStr, SyntaxText, TextRange, TextUnit, TokenAtOffset, WalkEvent};
|
||||
pub use rowan::{SmolStr, SyntaxText, TextRange, TextSize, TokenAtOffset, WalkEvent};
|
||||
|
||||
/// `Parse` is the result of the parsing: a syntax tree and a collection of
|
||||
/// errors.
|
||||
|
@ -266,7 +266,7 @@ fn api_walkthrough() {
|
|||
assert_eq!(expr_syntax.kind(), SyntaxKind::BIN_EXPR);
|
||||
|
||||
// And text range:
|
||||
assert_eq!(expr_syntax.text_range(), TextRange::from_to(32.into(), 37.into()));
|
||||
assert_eq!(expr_syntax.text_range(), TextRange::new(32.into(), 37.into()));
|
||||
|
||||
// You can get node's text as a `SyntaxText` object, which will traverse the
|
||||
// tree collecting token's text:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue