diff options
-rw-r--r-- | crates/ra_assists/src/assists/add_derive.rs (renamed from crates/ra_assists/src/add_derive.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/add_explicit_type.rs (renamed from crates/ra_assists/src/add_explicit_type.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/add_impl.rs (renamed from crates/ra_assists/src/add_impl.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/add_missing_impl_members.rs (renamed from crates/ra_assists/src/add_missing_impl_members.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/auto_import.rs (renamed from crates/ra_assists/src/auto_import.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/change_visibility.rs (renamed from crates/ra_assists/src/change_visibility.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/fill_match_arms.rs (renamed from crates/ra_assists/src/fill_match_arms.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/flip_binexpr.rs (renamed from crates/ra_assists/src/flip_binexpr.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/flip_comma.rs (renamed from crates/ra_assists/src/flip_comma.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/inline_local_variable.rs (renamed from crates/ra_assists/src/inline_local_variable.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/introduce_variable.rs (renamed from crates/ra_assists/src/introduce_variable.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/merge_match_arms.rs (renamed from crates/ra_assists/src/merge_match_arms.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/move_bounds.rs (renamed from crates/ra_assists/src/move_bounds.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/move_guard.rs (renamed from crates/ra_assists/src/move_guard.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/raw_string.rs (renamed from crates/ra_assists/src/raw_string.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/remove_dbg.rs (renamed from crates/ra_assists/src/remove_dbg.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/replace_if_let_with_match.rs (renamed from crates/ra_assists/src/replace_if_let_with_match.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/split_import.rs (renamed from crates/ra_assists/src/split_import.rs) | 0 | ||||
-rw-r--r-- | crates/ra_assists/src/lib.rs | 100 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_scope.rs | 4 |
20 files changed, 55 insertions, 49 deletions
diff --git a/crates/ra_assists/src/add_derive.rs b/crates/ra_assists/src/assists/add_derive.rs index 9c88644df..9c88644df 100644 --- a/crates/ra_assists/src/add_derive.rs +++ b/crates/ra_assists/src/assists/add_derive.rs | |||
diff --git a/crates/ra_assists/src/add_explicit_type.rs b/crates/ra_assists/src/assists/add_explicit_type.rs index 78f0f7f28..78f0f7f28 100644 --- a/crates/ra_assists/src/add_explicit_type.rs +++ b/crates/ra_assists/src/assists/add_explicit_type.rs | |||
diff --git a/crates/ra_assists/src/add_impl.rs b/crates/ra_assists/src/assists/add_impl.rs index 4b61f4031..4b61f4031 100644 --- a/crates/ra_assists/src/add_impl.rs +++ b/crates/ra_assists/src/assists/add_impl.rs | |||
diff --git a/crates/ra_assists/src/add_missing_impl_members.rs b/crates/ra_assists/src/assists/add_missing_impl_members.rs index cbeb7054f..cbeb7054f 100644 --- a/crates/ra_assists/src/add_missing_impl_members.rs +++ b/crates/ra_assists/src/assists/add_missing_impl_members.rs | |||
diff --git a/crates/ra_assists/src/auto_import.rs b/crates/ra_assists/src/assists/auto_import.rs index 5aae98546..5aae98546 100644 --- a/crates/ra_assists/src/auto_import.rs +++ b/crates/ra_assists/src/assists/auto_import.rs | |||
diff --git a/crates/ra_assists/src/change_visibility.rs b/crates/ra_assists/src/assists/change_visibility.rs index 60c74debc..60c74debc 100644 --- a/crates/ra_assists/src/change_visibility.rs +++ b/crates/ra_assists/src/assists/change_visibility.rs | |||
diff --git a/crates/ra_assists/src/fill_match_arms.rs b/crates/ra_assists/src/assists/fill_match_arms.rs index f59062bb9..f59062bb9 100644 --- a/crates/ra_assists/src/fill_match_arms.rs +++ b/crates/ra_assists/src/assists/fill_match_arms.rs | |||
diff --git a/crates/ra_assists/src/flip_binexpr.rs b/crates/ra_assists/src/assists/flip_binexpr.rs index b55b36a8e..b55b36a8e 100644 --- a/crates/ra_assists/src/flip_binexpr.rs +++ b/crates/ra_assists/src/assists/flip_binexpr.rs | |||
diff --git a/crates/ra_assists/src/flip_comma.rs b/crates/ra_assists/src/assists/flip_comma.rs index 5ee7561bc..5ee7561bc 100644 --- a/crates/ra_assists/src/flip_comma.rs +++ b/crates/ra_assists/src/assists/flip_comma.rs | |||
diff --git a/crates/ra_assists/src/inline_local_variable.rs b/crates/ra_assists/src/assists/inline_local_variable.rs index eedb29199..eedb29199 100644 --- a/crates/ra_assists/src/inline_local_variable.rs +++ b/crates/ra_assists/src/assists/inline_local_variable.rs | |||
diff --git a/crates/ra_assists/src/introduce_variable.rs b/crates/ra_assists/src/assists/introduce_variable.rs index 470ffe120..470ffe120 100644 --- a/crates/ra_assists/src/introduce_variable.rs +++ b/crates/ra_assists/src/assists/introduce_variable.rs | |||
diff --git a/crates/ra_assists/src/merge_match_arms.rs b/crates/ra_assists/src/assists/merge_match_arms.rs index 3b6a99895..3b6a99895 100644 --- a/crates/ra_assists/src/merge_match_arms.rs +++ b/crates/ra_assists/src/assists/merge_match_arms.rs | |||
diff --git a/crates/ra_assists/src/move_bounds.rs b/crates/ra_assists/src/assists/move_bounds.rs index 526de1d98..526de1d98 100644 --- a/crates/ra_assists/src/move_bounds.rs +++ b/crates/ra_assists/src/assists/move_bounds.rs | |||
diff --git a/crates/ra_assists/src/move_guard.rs b/crates/ra_assists/src/assists/move_guard.rs index 699221e33..699221e33 100644 --- a/crates/ra_assists/src/move_guard.rs +++ b/crates/ra_assists/src/assists/move_guard.rs | |||
diff --git a/crates/ra_assists/src/raw_string.rs b/crates/ra_assists/src/assists/raw_string.rs index 965a64c98..965a64c98 100644 --- a/crates/ra_assists/src/raw_string.rs +++ b/crates/ra_assists/src/assists/raw_string.rs | |||
diff --git a/crates/ra_assists/src/remove_dbg.rs b/crates/ra_assists/src/assists/remove_dbg.rs index 870133fda..870133fda 100644 --- a/crates/ra_assists/src/remove_dbg.rs +++ b/crates/ra_assists/src/assists/remove_dbg.rs | |||
diff --git a/crates/ra_assists/src/replace_if_let_with_match.rs b/crates/ra_assists/src/assists/replace_if_let_with_match.rs index 401835c57..401835c57 100644 --- a/crates/ra_assists/src/replace_if_let_with_match.rs +++ b/crates/ra_assists/src/assists/replace_if_let_with_match.rs | |||
diff --git a/crates/ra_assists/src/split_import.rs b/crates/ra_assists/src/assists/split_import.rs index 2c1edddb9..2c1edddb9 100644 --- a/crates/ra_assists/src/split_import.rs +++ b/crates/ra_assists/src/assists/split_import.rs | |||
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index 756acf415..5e4e8bc92 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs | |||
@@ -17,6 +17,7 @@ use ra_syntax::{TextRange, TextUnit}; | |||
17 | use ra_text_edit::TextEdit; | 17 | use ra_text_edit::TextEdit; |
18 | 18 | ||
19 | pub(crate) use crate::assist_ctx::{Assist, AssistCtx}; | 19 | pub(crate) use crate::assist_ctx::{Assist, AssistCtx}; |
20 | pub use crate::assists::auto_import::auto_import_text_edit; | ||
20 | 21 | ||
21 | /// Unique identifier of the assist, should not be shown to the user | 22 | /// Unique identifier of the assist, should not be shown to the user |
22 | /// directly. | 23 | /// directly. |
@@ -46,7 +47,7 @@ where | |||
46 | H: HirDatabase + 'static, | 47 | H: HirDatabase + 'static, |
47 | { | 48 | { |
48 | AssistCtx::with_ctx(db, range, false, |ctx| { | 49 | AssistCtx::with_ctx(db, range, false, |ctx| { |
49 | all_assists() | 50 | assists::all() |
50 | .iter() | 51 | .iter() |
51 | .filter_map(|f| f(ctx.clone())) | 52 | .filter_map(|f| f(ctx.clone())) |
52 | .map(|a| match a { | 53 | .map(|a| match a { |
@@ -68,7 +69,7 @@ where | |||
68 | use std::cmp::Ordering; | 69 | use std::cmp::Ordering; |
69 | 70 | ||
70 | AssistCtx::with_ctx(db, range, true, |ctx| { | 71 | AssistCtx::with_ctx(db, range, true, |ctx| { |
71 | let mut a = all_assists() | 72 | let mut a = assists::all() |
72 | .iter() | 73 | .iter() |
73 | .filter_map(|f| f(ctx.clone())) | 74 | .filter_map(|f| f(ctx.clone())) |
74 | .map(|a| match a { | 75 | .map(|a| match a { |
@@ -86,51 +87,56 @@ where | |||
86 | }) | 87 | }) |
87 | } | 88 | } |
88 | 89 | ||
89 | mod add_derive; | 90 | mod assists { |
90 | mod add_explicit_type; | 91 | use crate::{Assist, AssistCtx}; |
91 | mod add_impl; | 92 | use hir::db::HirDatabase; |
92 | mod flip_comma; | 93 | |
93 | mod flip_binexpr; | 94 | mod add_derive; |
94 | mod change_visibility; | 95 | mod add_explicit_type; |
95 | mod fill_match_arms; | 96 | mod add_impl; |
96 | mod merge_match_arms; | 97 | mod flip_comma; |
97 | mod introduce_variable; | 98 | mod flip_binexpr; |
98 | mod inline_local_variable; | 99 | mod change_visibility; |
99 | mod raw_string; | 100 | mod fill_match_arms; |
100 | mod replace_if_let_with_match; | 101 | mod merge_match_arms; |
101 | mod split_import; | 102 | mod introduce_variable; |
102 | mod remove_dbg; | 103 | mod inline_local_variable; |
103 | pub mod auto_import; | 104 | mod raw_string; |
104 | mod add_missing_impl_members; | 105 | mod replace_if_let_with_match; |
105 | mod move_guard; | 106 | mod split_import; |
106 | mod move_bounds; | 107 | mod remove_dbg; |
107 | 108 | pub(crate) mod auto_import; | |
108 | fn all_assists<DB: HirDatabase>() -> &'static [fn(AssistCtx<DB>) -> Option<Assist>] { | 109 | mod add_missing_impl_members; |
109 | &[ | 110 | mod move_guard; |
110 | add_derive::add_derive, | 111 | mod move_bounds; |
111 | add_explicit_type::add_explicit_type, | 112 | |
112 | add_impl::add_impl, | 113 | pub(crate) fn all<DB: HirDatabase>() -> &'static [fn(AssistCtx<DB>) -> Option<Assist>] { |
113 | change_visibility::change_visibility, | 114 | &[ |
114 | fill_match_arms::fill_match_arms, | 115 | add_derive::add_derive, |
115 | merge_match_arms::merge_match_arms, | 116 | add_explicit_type::add_explicit_type, |
116 | flip_comma::flip_comma, | 117 | add_impl::add_impl, |
117 | flip_binexpr::flip_binexpr, | 118 | change_visibility::change_visibility, |
118 | introduce_variable::introduce_variable, | 119 | fill_match_arms::fill_match_arms, |
119 | replace_if_let_with_match::replace_if_let_with_match, | 120 | merge_match_arms::merge_match_arms, |
120 | split_import::split_import, | 121 | flip_comma::flip_comma, |
121 | remove_dbg::remove_dbg, | 122 | flip_binexpr::flip_binexpr, |
122 | auto_import::auto_import, | 123 | introduce_variable::introduce_variable, |
123 | add_missing_impl_members::add_missing_impl_members, | 124 | replace_if_let_with_match::replace_if_let_with_match, |
124 | add_missing_impl_members::add_missing_default_members, | 125 | split_import::split_import, |
125 | inline_local_variable::inline_local_varialbe, | 126 | remove_dbg::remove_dbg, |
126 | move_guard::move_guard_to_arm_body, | 127 | auto_import::auto_import, |
127 | move_guard::move_arm_cond_to_match_guard, | 128 | add_missing_impl_members::add_missing_impl_members, |
128 | move_bounds::move_bounds_to_where_clause, | 129 | add_missing_impl_members::add_missing_default_members, |
129 | raw_string::add_hash, | 130 | inline_local_variable::inline_local_varialbe, |
130 | raw_string::make_raw_string, | 131 | move_guard::move_guard_to_arm_body, |
131 | raw_string::make_usual_string, | 132 | move_guard::move_arm_cond_to_match_guard, |
132 | raw_string::remove_hash, | 133 | move_bounds::move_bounds_to_where_clause, |
133 | ] | 134 | raw_string::add_hash, |
135 | raw_string::make_raw_string, | ||
136 | raw_string::make_usual_string, | ||
137 | raw_string::remove_hash, | ||
138 | ] | ||
139 | } | ||
134 | } | 140 | } |
135 | 141 | ||
136 | #[cfg(test)] | 142 | #[cfg(test)] |
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs index c1f48b026..cb70a1f21 100644 --- a/crates/ra_ide_api/src/completion/complete_scope.rs +++ b/crates/ra_ide_api/src/completion/complete_scope.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ra_assists::auto_import; | 1 | use ra_assists::auto_import_text_edit; |
2 | use ra_syntax::{ast, AstNode, SmolStr}; | 2 | use ra_syntax::{ast, AstNode, SmolStr}; |
3 | use ra_text_edit::TextEditBuilder; | 3 | use ra_text_edit::TextEditBuilder; |
4 | use rustc_hash::FxHashMap; | 4 | use rustc_hash::FxHashMap; |
@@ -23,7 +23,7 @@ pub(super) fn complete_scope(acc: &mut Completions, ctx: &CompletionContext) { | |||
23 | let edit = { | 23 | let edit = { |
24 | let mut builder = TextEditBuilder::default(); | 24 | let mut builder = TextEditBuilder::default(); |
25 | builder.replace(ctx.source_range(), name.to_string()); | 25 | builder.replace(ctx.source_range(), name.to_string()); |
26 | auto_import::auto_import_text_edit( | 26 | auto_import_text_edit( |
27 | &ctx.token.parent(), | 27 | &ctx.token.parent(), |
28 | &ctx.token.parent(), | 28 | &ctx.token.parent(), |
29 | &path, | 29 | &path, |