From 7e73b7a5f8d594a85627786a13e76d9d70163770 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 6 Feb 2020 18:46:11 +0100 Subject: [PATCH] Minor rename --- crates/ra_assists/src/doc_tests.rs | 6 ++++-- crates/ra_assists/src/lib.rs | 10 +++++----- crates/ra_ide/src/assists.rs | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/crates/ra_assists/src/doc_tests.rs b/crates/ra_assists/src/doc_tests.rs index 56020028cfa..ae0e5605c17 100644 --- a/crates/ra_assists/src/doc_tests.rs +++ b/crates/ra_assists/src/doc_tests.rs @@ -8,19 +8,21 @@ use ra_db::FileRange; use test_utils::{assert_eq_text, extract_range_or_offset}; +use crate::resolved_assists; + fn check(assist_id: &str, before: &str, after: &str) { let (selection, before) = extract_range_or_offset(before); let (db, file_id) = crate::helpers::with_single_file(&before); let frange = FileRange { file_id, range: selection.into() }; - let assist = crate::assists(&db, frange) + let assist = resolved_assists(&db, frange) .into_iter() .find(|assist| assist.label.id.0 == assist_id) .unwrap_or_else(|| { panic!( "\n\nAssist is not applicable: {}\nAvailable assists: {}", assist_id, - crate::assists(&db, frange) + resolved_assists(&db, frange) .into_iter() .map(|assist| assist.label.id.0) .collect::>() diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index 1343043ddf1..3f3df3f969b 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs @@ -59,7 +59,7 @@ pub fn get_first_action(&self) -> AssistAction { /// /// Assists are returned in the "unresolved" state, that is only labels are /// returned, without actual edits. -pub fn applicable_assists(db: &RootDatabase, range: FileRange) -> Vec { +pub fn unresolved_assists(db: &RootDatabase, range: FileRange) -> Vec { AssistCtx::with_ctx(db, range, false, |ctx| { assists::all() .iter() @@ -76,7 +76,7 @@ pub fn applicable_assists(db: &RootDatabase, range: FileRange) -> Vec Vec { +pub fn resolved_assists(db: &RootDatabase, range: FileRange) -> Vec { AssistCtx::with_ctx(db, range, true, |ctx| { let mut a = assists::all() .iter() @@ -301,7 +301,7 @@ mod tests { use ra_syntax::TextRange; use test_utils::{extract_offset, extract_range}; - use crate::helpers; + use crate::{helpers, resolved_assists}; #[test] fn assist_order_field_struct() { @@ -310,7 +310,7 @@ fn assist_order_field_struct() { let (db, file_id) = helpers::with_single_file(&before); let frange = FileRange { file_id, range: TextRange::offset_len(before_cursor_pos, 0.into()) }; - let assists = super::assists(&db, frange); + let assists = resolved_assists(&db, frange); let mut assists = assists.iter(); assert_eq!( @@ -333,7 +333,7 @@ pub fn test_some_range(a: int) -> bool { let (range, before) = extract_range(before); let (db, file_id) = helpers::with_single_file(&before); let frange = FileRange { file_id, range }; - let assists = super::assists(&db, frange); + let assists = resolved_assists(&db, frange); let mut assists = assists.iter(); assert_eq!(assists.next().expect("expected assist").label.label, "Extract into variable"); diff --git a/crates/ra_ide/src/assists.rs b/crates/ra_ide/src/assists.rs index c3b2c638b62..b60b1a60d61 100644 --- a/crates/ra_ide/src/assists.rs +++ b/crates/ra_ide/src/assists.rs @@ -1,7 +1,7 @@ //! FIXME: write short doc here use either::Either; -use ra_assists::{AssistAction, AssistLabel}; +use ra_assists::{resolved_assists, AssistAction, AssistLabel}; use ra_db::{FilePosition, FileRange}; use ra_ide_db::RootDatabase; @@ -17,7 +17,7 @@ pub struct Assist { } pub(crate) fn assists(db: &RootDatabase, frange: FileRange) -> Vec { - ra_assists::assists(db, frange) + resolved_assists(db, frange) .into_iter() .map(|assist| { let file_id = frange.file_id;