diff options
author | Kirill Bulatov <[email protected]> | 2020-01-01 23:39:01 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2020-01-15 18:16:27 +0000 |
commit | 73dc8b6f06b49f4728a50e83781c361e9a8b3100 (patch) | |
tree | 677cb7280fc39b27761bd4afd2e6294aec9d739c /crates/ra_assists/src/lib.rs | |
parent | 01422cc31d1917aaef4b1f402eda05abfff1e75f (diff) |
Another attempt to add multiple edits
Diffstat (limited to 'crates/ra_assists/src/lib.rs')
-rw-r--r-- | crates/ra_assists/src/lib.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index 150b34ac7..95a530821 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs | |||
@@ -35,6 +35,7 @@ pub struct AssistLabel { | |||
35 | 35 | ||
36 | #[derive(Debug, Clone)] | 36 | #[derive(Debug, Clone)] |
37 | pub struct AssistAction { | 37 | pub struct AssistAction { |
38 | pub label: Option<String>, | ||
38 | pub edit: TextEdit, | 39 | pub edit: TextEdit, |
39 | pub cursor_position: Option<TextUnit>, | 40 | pub cursor_position: Option<TextUnit>, |
40 | pub target: Option<TextRange>, | 41 | pub target: Option<TextRange>, |
@@ -64,7 +65,7 @@ where | |||
64 | /// | 65 | /// |
65 | /// Assists are returned in the "resolved" state, that is with edit fully | 66 | /// Assists are returned in the "resolved" state, that is with edit fully |
66 | /// computed. | 67 | /// computed. |
67 | pub fn assists<H>(db: &H, range: FileRange) -> Vec<(AssistLabel, AssistAction)> | 68 | pub fn assists<H>(db: &H, range: FileRange) -> Vec<(AssistLabel, AssistAction, Vec<AssistAction>)> |
68 | where | 69 | where |
69 | H: HirDatabase + 'static, | 70 | H: HirDatabase + 'static, |
70 | { | 71 | { |
@@ -75,7 +76,9 @@ where | |||
75 | .iter() | 76 | .iter() |
76 | .filter_map(|f| f(ctx.clone())) | 77 | .filter_map(|f| f(ctx.clone())) |
77 | .map(|a| match a { | 78 | .map(|a| match a { |
78 | Assist::Resolved { label, action } => (label, action), | 79 | Assist::Resolved { label, action, alternative_actions } => { |
80 | (label, action, alternative_actions) | ||
81 | } | ||
79 | Assist::Unresolved { .. } => unreachable!(), | 82 | Assist::Unresolved { .. } => unreachable!(), |
80 | }) | 83 | }) |
81 | .collect::<Vec<_>>(); | 84 | .collect::<Vec<_>>(); |