diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-03 13:44:09 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-03 13:44:09 +0100 |
commit | f51b0cfdd6c23dd57a0a11154179730171c0425d (patch) | |
tree | f856e6b751b23a20d68e9df5350ec39d5e8ee85b /crates/ra_assists/src/handlers/merge_imports.rs | |
parent | ef6a6d75d5dba2825e6b90e67e0b147a5f7158e1 (diff) | |
parent | 4c9347ecc3356748c52847a29d5e53a65778dc13 (diff) |
Merge #5116
5116: Categorize assists r=matklad a=kjeremy
Categorize assists so that editors can use them. Follows the LSP spec pretty close (and some things may need adjustments) but this populates the Refactor menu in vscode and pushes quickfixes through again.
This is a prerequisite to filtering out assists that the client doesn't care about.
Fixes #4147
Co-authored-by: Jeremy Kolb <[email protected]>
Co-authored-by: kjeremy <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/handlers/merge_imports.rs')
-rw-r--r-- | crates/ra_assists/src/handlers/merge_imports.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/crates/ra_assists/src/handlers/merge_imports.rs b/crates/ra_assists/src/handlers/merge_imports.rs index ac0b3035c..1beccb61c 100644 --- a/crates/ra_assists/src/handlers/merge_imports.rs +++ b/crates/ra_assists/src/handlers/merge_imports.rs | |||
@@ -8,7 +8,7 @@ use ra_syntax::{ | |||
8 | 8 | ||
9 | use crate::{ | 9 | use crate::{ |
10 | assist_context::{AssistContext, Assists}, | 10 | assist_context::{AssistContext, Assists}, |
11 | AssistId, | 11 | AssistId, AssistKind, |
12 | }; | 12 | }; |
13 | 13 | ||
14 | // Assist: merge_imports | 14 | // Assist: merge_imports |
@@ -56,9 +56,14 @@ pub(crate) fn merge_imports(acc: &mut Assists, ctx: &AssistContext) -> Option<() | |||
56 | }; | 56 | }; |
57 | 57 | ||
58 | let target = tree.syntax().text_range(); | 58 | let target = tree.syntax().text_range(); |
59 | acc.add(AssistId("merge_imports"), "Merge imports", target, |builder| { | 59 | acc.add( |
60 | builder.rewrite(rewriter); | 60 | AssistId("merge_imports", AssistKind::RefactorRewrite), |
61 | }) | 61 | "Merge imports", |
62 | target, | ||
63 | |builder| { | ||
64 | builder.rewrite(rewriter); | ||
65 | }, | ||
66 | ) | ||
62 | } | 67 | } |
63 | 68 | ||
64 | fn next_prev() -> impl Iterator<Item = Direction> { | 69 | fn next_prev() -> impl Iterator<Item = Direction> { |