diff options
author | vsrs <[email protected]> | 2020-05-08 17:34:34 +0100 |
---|---|---|
committer | vsrs <[email protected]> | 2020-05-08 17:34:34 +0100 |
commit | 0ef17ef1ee9fb0ce7149176d12f4d225f6d01401 (patch) | |
tree | fa2f168120f36f8dbef5dc1e85fea0c0071639c2 /crates/ra_assists/src/handlers/add_custom_impl.rs | |
parent | 1be6320ea6cf7830195f80681fa0f43cc340da7e (diff) | |
parent | d3eb9d8eafbebca7da95fa8a4813b92eb5080500 (diff) |
Merge remote-tracking branch 'upstream/master' into uniformed_debug_lens
# Conflicts:
# editors/code/src/commands/runnables.ts
Diffstat (limited to 'crates/ra_assists/src/handlers/add_custom_impl.rs')
-rw-r--r-- | crates/ra_assists/src/handlers/add_custom_impl.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/crates/ra_assists/src/handlers/add_custom_impl.rs b/crates/ra_assists/src/handlers/add_custom_impl.rs index 869d4dc04..795a225a4 100644 --- a/crates/ra_assists/src/handlers/add_custom_impl.rs +++ b/crates/ra_assists/src/handlers/add_custom_impl.rs | |||
@@ -6,7 +6,10 @@ use ra_syntax::{ | |||
6 | }; | 6 | }; |
7 | use stdx::SepBy; | 7 | use stdx::SepBy; |
8 | 8 | ||
9 | use crate::{Assist, AssistCtx, AssistId}; | 9 | use crate::{ |
10 | assist_context::{AssistContext, Assists}, | ||
11 | AssistId, | ||
12 | }; | ||
10 | 13 | ||
11 | // Assist: add_custom_impl | 14 | // Assist: add_custom_impl |
12 | // | 15 | // |
@@ -25,7 +28,7 @@ use crate::{Assist, AssistCtx, AssistId}; | |||
25 | // | 28 | // |
26 | // } | 29 | // } |
27 | // ``` | 30 | // ``` |
28 | pub(crate) fn add_custom_impl(ctx: AssistCtx) -> Option<Assist> { | 31 | pub(crate) fn add_custom_impl(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
29 | let input = ctx.find_node_at_offset::<ast::AttrInput>()?; | 32 | let input = ctx.find_node_at_offset::<ast::AttrInput>()?; |
30 | let attr = input.syntax().parent().and_then(ast::Attr::cast)?; | 33 | let attr = input.syntax().parent().and_then(ast::Attr::cast)?; |
31 | 34 | ||
@@ -49,7 +52,7 @@ pub(crate) fn add_custom_impl(ctx: AssistCtx) -> Option<Assist> { | |||
49 | format!("Add custom impl '{}' for '{}'", trait_token.text().as_str(), annotated_name); | 52 | format!("Add custom impl '{}' for '{}'", trait_token.text().as_str(), annotated_name); |
50 | 53 | ||
51 | let target = attr.syntax().text_range(); | 54 | let target = attr.syntax().text_range(); |
52 | ctx.add_assist(AssistId("add_custom_impl"), label, target, |edit| { | 55 | acc.add(AssistId("add_custom_impl"), label, target, |edit| { |
53 | let new_attr_input = input | 56 | let new_attr_input = input |
54 | .syntax() | 57 | .syntax() |
55 | .descendants_with_tokens() | 58 | .descendants_with_tokens() |