diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-24 12:52:44 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-02-24 12:52:44 +0000 |
commit | 043991662c648d86876be44bc3405ee3a60c37a1 (patch) | |
tree | 45fcbfb58cce8650f67ce4f41e1b5564ef49bfb3 /crates/ra_assists/src/fill_match_arms.rs | |
parent | f6f160391db945a0dcc2f73b38926d6919f7c566 (diff) | |
parent | c110e72a115bbec36413bd440812dfe9194c58e2 (diff) |
Merge #889
889: Refactor assits r=matklad a=matklad
* assign unique IDs to assists so that clients could do custom stuff
* specify kinds for assists,
* make introduce_variable a `refactoring.extract` and make it available only when expression is selected
* introduce marks to assists
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/fill_match_arms.rs')
-rw-r--r-- | crates/ra_assists/src/fill_match_arms.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_assists/src/fill_match_arms.rs b/crates/ra_assists/src/fill_match_arms.rs index 6bf6e7332..30020b56e 100644 --- a/crates/ra_assists/src/fill_match_arms.rs +++ b/crates/ra_assists/src/fill_match_arms.rs | |||
@@ -6,7 +6,7 @@ use hir::{ | |||
6 | }; | 6 | }; |
7 | use ra_syntax::ast::{self, AstNode}; | 7 | use ra_syntax::ast::{self, AstNode}; |
8 | 8 | ||
9 | use crate::{AssistCtx, Assist}; | 9 | use crate::{AssistCtx, Assist, AssistId}; |
10 | 10 | ||
11 | pub(crate) fn fill_match_arms(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | 11 | pub(crate) fn fill_match_arms(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { |
12 | let match_expr = ctx.node_at_offset::<ast::MatchExpr>()?; | 12 | let match_expr = ctx.node_at_offset::<ast::MatchExpr>()?; |
@@ -37,7 +37,7 @@ pub(crate) fn fill_match_arms(mut ctx: AssistCtx<impl HirDatabase>) -> Option<As | |||
37 | let enum_name = enum_def.name(ctx.db)?; | 37 | let enum_name = enum_def.name(ctx.db)?; |
38 | let db = ctx.db; | 38 | let db = ctx.db; |
39 | 39 | ||
40 | ctx.add_action("fill match arms", |edit| { | 40 | ctx.add_action(AssistId("fill_match_arms"), "fill match arms", |edit| { |
41 | let mut buf = format!("match {} {{\n", expr.syntax().text().to_string()); | 41 | let mut buf = format!("match {} {{\n", expr.syntax().text().to_string()); |
42 | let variants = enum_def.variants(db); | 42 | let variants = enum_def.variants(db); |
43 | for variant in variants { | 43 | for variant in variants { |