diff options
-rw-r--r-- | crates/ra_assists/src/assist_ctx.rs | 18 | ||||
-rw-r--r-- | crates/ra_assists/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/tests.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/lib.rs | 2 |
4 files changed, 13 insertions, 13 deletions
diff --git a/crates/ra_assists/src/assist_ctx.rs b/crates/ra_assists/src/assist_ctx.rs index 77275156c..af6756d17 100644 --- a/crates/ra_assists/src/assist_ctx.rs +++ b/crates/ra_assists/src/assist_ctx.rs | |||
@@ -22,16 +22,16 @@ pub(crate) struct Assist(pub(crate) Vec<AssistInfo>); | |||
22 | pub(crate) struct AssistInfo { | 22 | pub(crate) struct AssistInfo { |
23 | pub(crate) label: AssistLabel, | 23 | pub(crate) label: AssistLabel, |
24 | pub(crate) group_label: Option<GroupLabel>, | 24 | pub(crate) group_label: Option<GroupLabel>, |
25 | pub(crate) action: Option<SourceChange>, | 25 | pub(crate) source_change: Option<SourceChange>, |
26 | } | 26 | } |
27 | 27 | ||
28 | impl AssistInfo { | 28 | impl AssistInfo { |
29 | fn new(label: AssistLabel) -> AssistInfo { | 29 | fn new(label: AssistLabel) -> AssistInfo { |
30 | AssistInfo { label, group_label: None, action: None } | 30 | AssistInfo { label, group_label: None, source_change: None } |
31 | } | 31 | } |
32 | 32 | ||
33 | fn resolved(self, action: SourceChange) -> AssistInfo { | 33 | fn resolved(self, source_change: SourceChange) -> AssistInfo { |
34 | AssistInfo { action: Some(action), ..self } | 34 | AssistInfo { source_change: Some(source_change), ..self } |
35 | } | 35 | } |
36 | 36 | ||
37 | fn with_group(self, group_label: GroupLabel) -> AssistInfo { | 37 | fn with_group(self, group_label: GroupLabel) -> AssistInfo { |
@@ -40,7 +40,7 @@ impl AssistInfo { | |||
40 | 40 | ||
41 | pub(crate) fn into_resolved(self) -> Option<ResolvedAssist> { | 41 | pub(crate) fn into_resolved(self) -> Option<ResolvedAssist> { |
42 | let label = self.label; | 42 | let label = self.label; |
43 | self.action.map(|action| ResolvedAssist { label, action }) | 43 | self.source_change.map(|source_change| ResolvedAssist { label, source_change }) |
44 | } | 44 | } |
45 | } | 45 | } |
46 | 46 | ||
@@ -104,12 +104,12 @@ impl<'a> AssistCtx<'a> { | |||
104 | let change_label = label.label.clone(); | 104 | let change_label = label.label.clone(); |
105 | let mut info = AssistInfo::new(label); | 105 | let mut info = AssistInfo::new(label); |
106 | if self.should_compute_edit { | 106 | if self.should_compute_edit { |
107 | let action = { | 107 | let source_change = { |
108 | let mut edit = ActionBuilder::new(&self); | 108 | let mut edit = ActionBuilder::new(&self); |
109 | f(&mut edit); | 109 | f(&mut edit); |
110 | edit.build(change_label, self.frange.file_id) | 110 | edit.build(change_label, self.frange.file_id) |
111 | }; | 111 | }; |
112 | info = info.resolved(action) | 112 | info = info.resolved(source_change) |
113 | }; | 113 | }; |
114 | 114 | ||
115 | Some(Assist(vec![info])) | 115 | Some(Assist(vec![info])) |
@@ -163,12 +163,12 @@ impl<'a> AssistGroup<'a> { | |||
163 | let change_label = label.label.clone(); | 163 | let change_label = label.label.clone(); |
164 | let mut info = AssistInfo::new(label).with_group(self.group.clone()); | 164 | let mut info = AssistInfo::new(label).with_group(self.group.clone()); |
165 | if self.ctx.should_compute_edit { | 165 | if self.ctx.should_compute_edit { |
166 | let action = { | 166 | let source_change = { |
167 | let mut edit = ActionBuilder::new(&self.ctx); | 167 | let mut edit = ActionBuilder::new(&self.ctx); |
168 | f(&mut edit); | 168 | f(&mut edit); |
169 | edit.build(change_label, self.ctx.frange.file_id) | 169 | edit.build(change_label, self.ctx.frange.file_id) |
170 | }; | 170 | }; |
171 | info = info.resolved(action) | 171 | info = info.resolved(source_change) |
172 | }; | 172 | }; |
173 | 173 | ||
174 | self.assists.push(info) | 174 | self.assists.push(info) |
diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index 8cd8f89c4..6e81ea8ee 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs | |||
@@ -59,7 +59,7 @@ impl AssistLabel { | |||
59 | #[derive(Debug, Clone)] | 59 | #[derive(Debug, Clone)] |
60 | pub struct ResolvedAssist { | 60 | pub struct ResolvedAssist { |
61 | pub label: AssistLabel, | 61 | pub label: AssistLabel, |
62 | pub action: SourceChange, | 62 | pub source_change: SourceChange, |
63 | } | 63 | } |
64 | 64 | ||
65 | #[derive(Debug, Clone, Copy)] | 65 | #[derive(Debug, Clone, Copy)] |
diff --git a/crates/ra_assists/src/tests.rs b/crates/ra_assists/src/tests.rs index 572462bfc..17e3ece9f 100644 --- a/crates/ra_assists/src/tests.rs +++ b/crates/ra_assists/src/tests.rs | |||
@@ -57,7 +57,7 @@ fn check_doc_test(assist_id: &str, before: &str, after: &str) { | |||
57 | }); | 57 | }); |
58 | 58 | ||
59 | let actual = { | 59 | let actual = { |
60 | let change = assist.action.source_file_edits.pop().unwrap(); | 60 | let change = assist.source_change.source_file_edits.pop().unwrap(); |
61 | let mut actual = before.clone(); | 61 | let mut actual = before.clone(); |
62 | change.edit.apply(&mut actual); | 62 | change.edit.apply(&mut actual); |
63 | actual | 63 | actual |
@@ -94,7 +94,7 @@ fn check(assist: Handler, before: &str, expected: ExpectedResult) { | |||
94 | 94 | ||
95 | match (assist(assist_ctx), expected) { | 95 | match (assist(assist_ctx), expected) { |
96 | (Some(assist), ExpectedResult::After(after)) => { | 96 | (Some(assist), ExpectedResult::After(after)) => { |
97 | let mut action = assist.0[0].action.clone().unwrap(); | 97 | let mut action = assist.0[0].source_change.clone().unwrap(); |
98 | let change = action.source_file_edits.pop().unwrap(); | 98 | let change = action.source_file_edits.pop().unwrap(); |
99 | 99 | ||
100 | let mut actual = db.file_text(change.file_id).as_ref().to_owned(); | 100 | let mut actual = db.file_text(change.file_id).as_ref().to_owned(); |
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 614029de4..737f87109 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs | |||
@@ -478,7 +478,7 @@ impl Analysis { | |||
478 | id: assist.label.id, | 478 | id: assist.label.id, |
479 | label: assist.label.label, | 479 | label: assist.label.label, |
480 | group_label: assist.label.group.map(|it| it.0), | 480 | group_label: assist.label.group.map(|it| it.0), |
481 | source_change: assist.action, | 481 | source_change: assist.source_change, |
482 | }) | 482 | }) |
483 | .collect() | 483 | .collect() |
484 | }) | 484 | }) |