diff options
author | Aleksey Kladov <[email protected]> | 2018-08-22 10:58:34 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-22 10:58:34 +0100 |
commit | e8dfb92641f64b772204d7670c7286cb9b8b398b (patch) | |
tree | bb305d3003d01756fc8c282f008108d05da7decf /crates/libeditor/src | |
parent | 641659d5a8dcca0b8a1c36ff6d1c517a91296116 (diff) |
Simplify
Diffstat (limited to 'crates/libeditor/src')
-rw-r--r-- | crates/libeditor/src/code_actions.rs | 11 | ||||
-rw-r--r-- | crates/libeditor/src/lib.rs | 2 |
2 files changed, 4 insertions, 9 deletions
diff --git a/crates/libeditor/src/code_actions.rs b/crates/libeditor/src/code_actions.rs index 80c396337..500d52c2a 100644 --- a/crates/libeditor/src/code_actions.rs +++ b/crates/libeditor/src/code_actions.rs | |||
@@ -11,12 +11,7 @@ use libsyntax2::{ | |||
11 | 11 | ||
12 | pub struct ActionResult { | 12 | pub struct ActionResult { |
13 | pub edit: Edit, | 13 | pub edit: Edit, |
14 | pub cursor_position: CursorPosition, | 14 | pub cursor_position: Option<TextUnit>, |
15 | } | ||
16 | |||
17 | pub enum CursorPosition { | ||
18 | Same, | ||
19 | Offset(TextUnit), | ||
20 | } | 15 | } |
21 | 16 | ||
22 | pub fn flip_comma<'a>(file: &'a ParsedFile, offset: TextUnit) -> Option<impl FnOnce() -> ActionResult + 'a> { | 17 | pub fn flip_comma<'a>(file: &'a ParsedFile, offset: TextUnit) -> Option<impl FnOnce() -> ActionResult + 'a> { |
@@ -31,7 +26,7 @@ pub fn flip_comma<'a>(file: &'a ParsedFile, offset: TextUnit) -> Option<impl FnO | |||
31 | edit.replace(right.range(), left.text()); | 26 | edit.replace(right.range(), left.text()); |
32 | ActionResult { | 27 | ActionResult { |
33 | edit: edit.finish(), | 28 | edit: edit.finish(), |
34 | cursor_position: CursorPosition::Same, | 29 | cursor_position: None, |
35 | } | 30 | } |
36 | }) | 31 | }) |
37 | } | 32 | } |
@@ -58,7 +53,7 @@ pub fn add_derive<'a>(file: &'a ParsedFile, offset: TextUnit) -> Option<impl FnO | |||
58 | }; | 53 | }; |
59 | ActionResult { | 54 | ActionResult { |
60 | edit: edit.finish(), | 55 | edit: edit.finish(), |
61 | cursor_position: CursorPosition::Offset(offset), | 56 | cursor_position: Some(offset), |
62 | } | 57 | } |
63 | }) | 58 | }) |
64 | } | 59 | } |
diff --git a/crates/libeditor/src/lib.rs b/crates/libeditor/src/lib.rs index abd104af2..12d0a30dd 100644 --- a/crates/libeditor/src/lib.rs +++ b/crates/libeditor/src/lib.rs | |||
@@ -21,7 +21,7 @@ pub use self::{ | |||
21 | symbols::{StructureNode, file_structure, FileSymbol, file_symbols}, | 21 | symbols::{StructureNode, file_structure, FileSymbol, file_symbols}, |
22 | edit::{EditBuilder, Edit, AtomEdit}, | 22 | edit::{EditBuilder, Edit, AtomEdit}, |
23 | code_actions::{ | 23 | code_actions::{ |
24 | ActionResult, CursorPosition, find_node, | 24 | ActionResult, find_node, |
25 | flip_comma, add_derive, | 25 | flip_comma, add_derive, |
26 | }, | 26 | }, |
27 | }; | 27 | }; |