diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-10-26 18:58:12 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-10-26 18:58:12 +0100 |
commit | 106004139375b64817145d8279cd7904a477c637 (patch) | |
tree | b8944447b98e8b0b25ac95d0465210312bf4cd57 /crates/ra_assists/src/doc_tests.rs | |
parent | 733fd64260793a0f7335e4f75ba9197d5fa98b70 (diff) | |
parent | 4a83aae09849123dbbbc5726b07c2601a14397a8 (diff) |
Merge #2078
2078: support range selection in assist docs r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/doc_tests.rs')
-rw-r--r-- | crates/ra_assists/src/doc_tests.rs | 7 |
1 files changed, 3 insertions, 4 deletions
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; | |||
7 | 7 | ||
8 | use hir::mock::MockDatabase; | 8 | use hir::mock::MockDatabase; |
9 | use ra_db::FileRange; | 9 | use ra_db::FileRange; |
10 | use ra_syntax::TextRange; | 10 | use test_utils::{assert_eq_text, extract_range_or_offset}; |
11 | use test_utils::{assert_eq_text, extract_offset}; | ||
12 | 11 | ||
13 | fn check(assist_id: &str, before: &str, after: &str) { | 12 | fn check(assist_id: &str, before: &str, after: &str) { |
14 | let (before_cursor_pos, before) = extract_offset(before); | 13 | let (selection, before) = extract_range_or_offset(before); |
15 | let (db, _source_root, file_id) = MockDatabase::with_single_file(&before); | 14 | let (db, _source_root, file_id) = MockDatabase::with_single_file(&before); |
16 | let frange = FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; | 15 | let frange = FileRange { file_id, range: selection.into() }; |
17 | 16 | ||
18 | let (_assist_id, action) = crate::assists(&db, frange) | 17 | let (_assist_id, action) = crate::assists(&db, frange) |
19 | .into_iter() | 18 | .into_iter() |