aboutsummaryrefslogtreecommitdiff
path: root/crates/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/server/src')
-rw-r--r--crates/server/src/main_loop/handlers.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/server/src/main_loop/handlers.rs b/crates/server/src/main_loop/handlers.rs
index 9ff821a8b..b47cbc0fc 100644
--- a/crates/server/src/main_loop/handlers.rs
+++ b/crates/server/src/main_loop/handlers.rs
@@ -110,6 +110,7 @@ pub fn handle_code_action(
110 let actions = &[ 110 let actions = &[
111 (ActionId::FlipComma, libeditor::flip_comma(&file, offset).is_some()), 111 (ActionId::FlipComma, libeditor::flip_comma(&file, offset).is_some()),
112 (ActionId::AddDerive, libeditor::add_derive(&file, offset).is_some()), 112 (ActionId::AddDerive, libeditor::add_derive(&file, offset).is_some()),
113 (ActionId::AddImpl, libeditor::add_impl(&file, offset).is_some()),
113 ]; 114 ];
114 115
115 for (id, edit) in actions { 116 for (id, edit) in actions {
@@ -218,6 +219,7 @@ pub fn handle_execute_command(
218 let action_result = match arg.id { 219 let action_result = match arg.id {
219 ActionId::FlipComma => libeditor::flip_comma(&file, arg.offset).map(|f| f()), 220 ActionId::FlipComma => libeditor::flip_comma(&file, arg.offset).map(|f| f()),
220 ActionId::AddDerive => libeditor::add_derive(&file, arg.offset).map(|f| f()), 221 ActionId::AddDerive => libeditor::add_derive(&file, arg.offset).map(|f| f()),
222 ActionId::AddImpl => libeditor::add_impl(&file, arg.offset).map(|f| f()),
221 }.ok_or_else(|| format_err!("command not applicable"))?; 223 }.ok_or_else(|| format_err!("command not applicable"))?;
222 let line_index = world.analysis().file_line_index(file_id)?; 224 let line_index = world.analysis().file_line_index(file_id)?;
223 let mut changes = HashMap::new(); 225 let mut changes = HashMap::new();
@@ -259,6 +261,7 @@ fn apply_code_action_cmd(id: ActionId, doc: TextDocumentIdentifier, offset: Text
259enum ActionId { 261enum ActionId {
260 FlipComma, 262 FlipComma,
261 AddDerive, 263 AddDerive,
264 AddImpl,
262} 265}
263 266
264impl ActionId { 267impl ActionId {
@@ -266,6 +269,7 @@ impl ActionId {
266 match *self { 269 match *self {
267 ActionId::FlipComma => "Flip `,`", 270 ActionId::FlipComma => "Flip `,`",
268 ActionId::AddDerive => "Add `#[derive]`", 271 ActionId::AddDerive => "Add `#[derive]`",
272 ActionId::AddImpl => "Add impl",
269 } 273 }
270 } 274 }
271} 275}