diff options
Diffstat (limited to 'crates/ide_assists/src/lib.rs')
-rw-r--r-- | crates/ide_assists/src/lib.rs | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/crates/ide_assists/src/lib.rs b/crates/ide_assists/src/lib.rs index 331a6df2b..804918284 100644 --- a/crates/ide_assists/src/lib.rs +++ b/crates/ide_assists/src/lib.rs | |||
@@ -151,22 +151,20 @@ pub struct Assist { | |||
151 | pub source_change: Option<SourceChange>, | 151 | pub source_change: Option<SourceChange>, |
152 | } | 152 | } |
153 | 153 | ||
154 | impl Assist { | 154 | /// Return all the assists applicable at the given position. |
155 | /// Return all the assists applicable at the given position. | 155 | pub fn assists( |
156 | pub fn get( | 156 | db: &RootDatabase, |
157 | db: &RootDatabase, | 157 | config: &AssistConfig, |
158 | config: &AssistConfig, | 158 | resolve: AssistResolveStrategy, |
159 | resolve: AssistResolveStrategy, | 159 | range: FileRange, |
160 | range: FileRange, | 160 | ) -> Vec<Assist> { |
161 | ) -> Vec<Assist> { | 161 | let sema = Semantics::new(db); |
162 | let sema = Semantics::new(db); | 162 | let ctx = AssistContext::new(sema, config, range); |
163 | let ctx = AssistContext::new(sema, config, range); | 163 | let mut acc = Assists::new(&ctx, resolve); |
164 | let mut acc = Assists::new(&ctx, resolve); | 164 | handlers::all().iter().for_each(|handler| { |
165 | handlers::all().iter().for_each(|handler| { | 165 | handler(&mut acc, &ctx); |
166 | handler(&mut acc, &ctx); | 166 | }); |
167 | }); | 167 | acc.finish() |
168 | acc.finish() | ||
169 | } | ||
170 | } | 168 | } |
171 | 169 | ||
172 | mod handlers { | 170 | mod handlers { |