From 4a83aae09849123dbbbc5726b07c2601a14397a8 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 26 Oct 2019 19:58:18 +0300 Subject: support range selection in assist docs --- crates/ra_assists/src/doc_tests.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'crates/ra_assists/src/doc_tests.rs') diff --git a/crates/ra_assists/src/doc_tests.rs b/crates/ra_assists/src/doc_tests.rs index 872bbdf17..0ccf9d730 100644 --- a/crates/ra_assists/src/doc_tests.rs +++ b/crates/ra_assists/src/doc_tests.rs @@ -7,13 +7,12 @@ mod generated; use hir::mock::MockDatabase; use ra_db::FileRange; -use ra_syntax::TextRange; -use test_utils::{assert_eq_text, extract_offset}; +use test_utils::{assert_eq_text, extract_range_or_offset}; fn check(assist_id: &str, before: &str, after: &str) { - let (before_cursor_pos, before) = extract_offset(before); + let (selection, before) = extract_range_or_offset(before); let (db, _source_root, file_id) = MockDatabase::with_single_file(&before); - let frange = FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; + let frange = FileRange { file_id, range: selection.into() }; let (_assist_id, action) = crate::assists(&db, frange) .into_iter() -- cgit v1.2.3