diff options
Diffstat (limited to 'crates/ra_assists/src/lib.rs')
-rw-r--r-- | crates/ra_assists/src/lib.rs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index b6dc7cb1b..7f0a723c9 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs | |||
@@ -10,6 +10,7 @@ macro_rules! eprintln { | |||
10 | ($($tt:tt)*) => { stdx::eprintln!($($tt)*) }; | 10 | ($($tt:tt)*) => { stdx::eprintln!($($tt)*) }; |
11 | } | 11 | } |
12 | 12 | ||
13 | mod assist_config; | ||
13 | mod assist_context; | 14 | mod assist_context; |
14 | mod marks; | 15 | mod marks; |
15 | #[cfg(test)] | 16 | #[cfg(test)] |
@@ -24,6 +25,8 @@ use ra_syntax::TextRange; | |||
24 | 25 | ||
25 | pub(crate) use crate::assist_context::{AssistContext, Assists}; | 26 | pub(crate) use crate::assist_context::{AssistContext, Assists}; |
26 | 27 | ||
28 | pub use assist_config::AssistConfig; | ||
29 | |||
27 | /// Unique identifier of the assist, should not be shown to the user | 30 | /// Unique identifier of the assist, should not be shown to the user |
28 | /// directly. | 31 | /// directly. |
29 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | 32 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
@@ -54,9 +57,9 @@ impl Assist { | |||
54 | /// | 57 | /// |
55 | /// Assists are returned in the "unresolved" state, that is only labels are | 58 | /// Assists are returned in the "unresolved" state, that is only labels are |
56 | /// returned, without actual edits. | 59 | /// returned, without actual edits. |
57 | pub fn unresolved(db: &RootDatabase, range: FileRange) -> Vec<Assist> { | 60 | pub fn unresolved(db: &RootDatabase, config: &AssistConfig, range: FileRange) -> Vec<Assist> { |
58 | let sema = Semantics::new(db); | 61 | let sema = Semantics::new(db); |
59 | let ctx = AssistContext::new(sema, range); | 62 | let ctx = AssistContext::new(sema, config, range); |
60 | let mut acc = Assists::new_unresolved(&ctx); | 63 | let mut acc = Assists::new_unresolved(&ctx); |
61 | handlers::all().iter().for_each(|handler| { | 64 | handlers::all().iter().for_each(|handler| { |
62 | handler(&mut acc, &ctx); | 65 | handler(&mut acc, &ctx); |
@@ -68,9 +71,13 @@ impl Assist { | |||
68 | /// | 71 | /// |
69 | /// Assists are returned in the "resolved" state, that is with edit fully | 72 | /// Assists are returned in the "resolved" state, that is with edit fully |
70 | /// computed. | 73 | /// computed. |
71 | pub fn resolved(db: &RootDatabase, range: FileRange) -> Vec<ResolvedAssist> { | 74 | pub fn resolved( |
75 | db: &RootDatabase, | ||
76 | config: &AssistConfig, | ||
77 | range: FileRange, | ||
78 | ) -> Vec<ResolvedAssist> { | ||
72 | let sema = Semantics::new(db); | 79 | let sema = Semantics::new(db); |
73 | let ctx = AssistContext::new(sema, range); | 80 | let ctx = AssistContext::new(sema, config, range); |
74 | let mut acc = Assists::new_resolved(&ctx); | 81 | let mut acc = Assists::new_resolved(&ctx); |
75 | handlers::all().iter().for_each(|handler| { | 82 | handlers::all().iter().for_each(|handler| { |
76 | handler(&mut acc, &ctx); | 83 | handler(&mut acc, &ctx); |