mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
rename ra_ide_api -> ra_ide
This commit is contained in:
parent
d9a36a736b
commit
757e593b25
81 changed files with 48 additions and 48 deletions
|
@ -1,21 +0,0 @@
|
|||
//! FIXME: write short doc here
|
||||
|
||||
use ra_syntax::{SourceFile, TextUnit};
|
||||
use ra_text_edit::TextEdit;
|
||||
|
||||
pub use test_utils::*;
|
||||
|
||||
pub fn check_action<F: Fn(&SourceFile, TextUnit) -> Option<TextEdit>>(
|
||||
before: &str,
|
||||
after: &str,
|
||||
f: F,
|
||||
) {
|
||||
let (before_cursor_pos, before) = extract_offset(before);
|
||||
let file = SourceFile::parse(&before).ok().unwrap();
|
||||
let result = f(&file, before_cursor_pos).expect("code action is not applicable");
|
||||
let actual = result.apply(&before);
|
||||
let actual_cursor_pos =
|
||||
result.apply_to_offset(before_cursor_pos).expect("cursor position is affected by the edit");
|
||||
let actual = add_cursor(&actual, actual_cursor_pos);
|
||||
assert_eq_text!(after, &actual);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue