mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 14:21:44 +00:00
make Parse fields private
this is in preparation for the new rowan API
This commit is contained in:
parent
2e466bb365
commit
deab4caa7b
31 changed files with 109 additions and 99 deletions
|
@ -11,8 +11,8 @@ use crate::{db::RootDatabase, FileRange};
|
|||
|
||||
// FIXME: restore macro support
|
||||
pub(crate) fn extend_selection(db: &RootDatabase, frange: FileRange) -> TextRange {
|
||||
let source_file = db.parse(frange.file_id).tree;
|
||||
try_extend_selection(source_file.syntax(), frange.range).unwrap_or(frange.range)
|
||||
let parse = db.parse(frange.file_id);
|
||||
try_extend_selection(parse.tree().syntax(), frange.range).unwrap_or(frange.range)
|
||||
}
|
||||
|
||||
fn try_extend_selection(root: &SyntaxNode, range: TextRange) -> Option<TextRange> {
|
||||
|
@ -212,10 +212,10 @@ mod tests {
|
|||
|
||||
fn do_check(before: &str, afters: &[&str]) {
|
||||
let (cursor, before) = extract_offset(before);
|
||||
let file = SourceFile::parse(&before).tree;
|
||||
let parse = SourceFile::parse(&before);
|
||||
let mut range = TextRange::offset_len(cursor, 0.into());
|
||||
for &after in afters {
|
||||
range = try_extend_selection(file.syntax(), range).unwrap();
|
||||
range = try_extend_selection(parse.tree().syntax(), range).unwrap();
|
||||
let actual = &before[range];
|
||||
assert_eq!(after, actual);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue