mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +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
|
@ -5,7 +5,7 @@ use ra_ide_db::RootDatabase;
|
|||
use ra_syntax::{
|
||||
algo, AstNode, NodeOrToken, SourceFile,
|
||||
SyntaxKind::{RAW_STRING, STRING},
|
||||
SyntaxToken, TextRange, TextUnit,
|
||||
SyntaxToken, TextRange, TextSize,
|
||||
};
|
||||
|
||||
pub use ra_db::FileId;
|
||||
|
@ -66,13 +66,13 @@ fn syntax_tree_for_token(node: &SyntaxToken, text_range: TextRange) -> Option<St
|
|||
let len = len.min(node_len);
|
||||
|
||||
// Ensure our slice is inside the actual string
|
||||
let end = if start + len < TextUnit::of_str(&text) {
|
||||
let end = if start + len < TextSize::of(&text) {
|
||||
start + len
|
||||
} else {
|
||||
TextUnit::of_str(&text) - start
|
||||
TextSize::of(&text) - start
|
||||
};
|
||||
|
||||
let text = &text[TextRange::from_to(start, end)];
|
||||
let text = &text[TextRange::new(start, end)];
|
||||
|
||||
// Remove possible extra string quotes from the start
|
||||
// and the end of the string
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue