mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Rename File -> SourceFileNode
This commit is contained in:
parent
2119fe2143
commit
f8b36bbc3b
23 changed files with 117 additions and 102 deletions
|
@ -1,10 +1,14 @@
|
|||
use crate::LocalEdit;
|
||||
pub use crate::_test_utils::*;
|
||||
use ra_syntax::{File, TextRange, TextUnit};
|
||||
use ra_syntax::{SourceFileNode, TextRange, TextUnit};
|
||||
|
||||
pub fn check_action<F: Fn(&File, TextUnit) -> Option<LocalEdit>>(before: &str, after: &str, f: F) {
|
||||
pub fn check_action<F: Fn(&SourceFileNode, TextUnit) -> Option<LocalEdit>>(
|
||||
before: &str,
|
||||
after: &str,
|
||||
f: F,
|
||||
) {
|
||||
let (before_cursor_pos, before) = extract_offset(before);
|
||||
let file = File::parse(&before);
|
||||
let file = SourceFileNode::parse(&before);
|
||||
let result = f(&file, before_cursor_pos).expect("code action is not applicable");
|
||||
let actual = result.edit.apply(&before);
|
||||
let actual_cursor_pos = match result.cursor_position {
|
||||
|
@ -15,13 +19,13 @@ pub fn check_action<F: Fn(&File, TextUnit) -> Option<LocalEdit>>(before: &str, a
|
|||
assert_eq_text!(after, &actual);
|
||||
}
|
||||
|
||||
pub fn check_action_range<F: Fn(&File, TextRange) -> Option<LocalEdit>>(
|
||||
pub fn check_action_range<F: Fn(&SourceFileNode, TextRange) -> Option<LocalEdit>>(
|
||||
before: &str,
|
||||
after: &str,
|
||||
f: F,
|
||||
) {
|
||||
let (range, before) = extract_range(before);
|
||||
let file = File::parse(&before);
|
||||
let file = SourceFileNode::parse(&before);
|
||||
let result = f(&file, range).expect("code action is not applicable");
|
||||
let actual = result.edit.apply(&before);
|
||||
let actual_cursor_pos = match result.cursor_position {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue