mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
Merge #2839
2839: Tweak add_custom_impl r=matklad a=kjeremy Display a nicer label and categorize Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
This commit is contained in:
commit
e406f2bed6
2 changed files with 5 additions and 1 deletions
|
@ -49,7 +49,10 @@ pub(crate) fn add_custom_impl(ctx: AssistCtx<impl HirDatabase>) -> Option<Assist
|
||||||
let annotated_name = annotated.syntax().text().to_string();
|
let annotated_name = annotated.syntax().text().to_string();
|
||||||
let start_offset = annotated.syntax().parent()?.text_range().end();
|
let start_offset = annotated.syntax().parent()?.text_range().end();
|
||||||
|
|
||||||
ctx.add_assist(AssistId("add_custom_impl"), "add custom impl", |edit| {
|
let label =
|
||||||
|
format!("Add Custom impl '{}' for '{}'", trait_token.text().as_str(), annotated_name);
|
||||||
|
|
||||||
|
ctx.add_assist(AssistId("add_custom_impl"), label, |edit| {
|
||||||
edit.target(attr.syntax().text_range());
|
edit.target(attr.syntax().text_range());
|
||||||
|
|
||||||
let new_attr_input = input
|
let new_attr_input = input
|
||||||
|
|
|
@ -710,6 +710,7 @@ pub fn handle_code_action(
|
||||||
title: command.title.clone(),
|
title: command.title.clone(),
|
||||||
kind: match assist.id {
|
kind: match assist.id {
|
||||||
AssistId("introduce_variable") => Some("refactor.extract.variable".to_string()),
|
AssistId("introduce_variable") => Some("refactor.extract.variable".to_string()),
|
||||||
|
AssistId("add_custom_impl") => Some("refactor.rewrite.add_custom_impl".to_string()),
|
||||||
_ => None,
|
_ => None,
|
||||||
},
|
},
|
||||||
diagnostics: None,
|
diagnostics: None,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue