aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/flip_comma.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/flip_comma.rs')
-rw-r--r--crates/ra_assists/src/flip_comma.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ra_assists/src/flip_comma.rs b/crates/ra_assists/src/flip_comma.rs
index 0d4a789fc..6b98cac68 100644
--- a/crates/ra_assists/src/flip_comma.rs
+++ b/crates/ra_assists/src/flip_comma.rs
@@ -5,13 +5,13 @@ use ra_syntax::{
5 algo::non_trivia_sibling, 5 algo::non_trivia_sibling,
6}; 6};
7 7
8use crate::{AssistCtx, Assist}; 8use crate::{AssistCtx, Assist, AssistId};
9 9
10pub(crate) fn flip_comma(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { 10pub(crate) fn flip_comma(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> {
11 let comma = ctx.leaf_at_offset().find(|leaf| leaf.kind() == COMMA)?; 11 let comma = ctx.leaf_at_offset().find(|leaf| leaf.kind() == COMMA)?;
12 let prev = non_trivia_sibling(comma, Direction::Prev)?; 12 let prev = non_trivia_sibling(comma, Direction::Prev)?;
13 let next = non_trivia_sibling(comma, Direction::Next)?; 13 let next = non_trivia_sibling(comma, Direction::Next)?;
14 ctx.add_action("flip comma", |edit| { 14 ctx.add_action(AssistId("flip_comma"), "flip comma", |edit| {
15 edit.target(comma.range()); 15 edit.target(comma.range());
16 edit.replace(prev.range(), next.text()); 16 edit.replace(prev.range(), next.text());
17 edit.replace(next.range(), prev.text()); 17 edit.replace(next.range(), prev.text());