diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_assists/src/assist_context.rs | 3 | ||||
-rw-r--r-- | crates/ra_ide/src/typing.rs | 3 | ||||
-rw-r--r-- | crates/ra_ide_db/src/source_change.rs | 5 |
3 files changed, 3 insertions, 8 deletions
diff --git a/crates/ra_assists/src/assist_context.rs b/crates/ra_assists/src/assist_context.rs index 9f6ca449b..f3af70a3e 100644 --- a/crates/ra_assists/src/assist_context.rs +++ b/crates/ra_assists/src/assist_context.rs | |||
@@ -248,8 +248,7 @@ impl AssistBuilder { | |||
248 | 248 | ||
249 | fn finish(self, change_label: String) -> SourceChange { | 249 | fn finish(self, change_label: String) -> SourceChange { |
250 | let edit = self.edit.finish(); | 250 | let edit = self.edit.finish(); |
251 | let mut res = SingleFileChange { label: change_label, edit, cursor_position: None } | 251 | let mut res = SingleFileChange { label: change_label, edit }.into_source_change(self.file); |
252 | .into_source_change(self.file); | ||
253 | if self.is_snippet { | 252 | if self.is_snippet { |
254 | res.is_snippet = true; | 253 | res.is_snippet = true; |
255 | } | 254 | } |
diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs index 867a0f0bd..cd48cad93 100644 --- a/crates/ra_ide/src/typing.rs +++ b/crates/ra_ide/src/typing.rs | |||
@@ -82,7 +82,6 @@ fn on_eq_typed(file: &SourceFile, offset: TextSize) -> Option<SingleFileChange> | |||
82 | Some(SingleFileChange { | 82 | Some(SingleFileChange { |
83 | label: "add semicolon".to_string(), | 83 | label: "add semicolon".to_string(), |
84 | edit: TextEdit::insert(offset, ";".to_string()), | 84 | edit: TextEdit::insert(offset, ";".to_string()), |
85 | cursor_position: None, | ||
86 | }) | 85 | }) |
87 | } | 86 | } |
88 | 87 | ||
@@ -111,7 +110,6 @@ fn on_dot_typed(file: &SourceFile, offset: TextSize) -> Option<SingleFileChange> | |||
111 | Some(SingleFileChange { | 110 | Some(SingleFileChange { |
112 | label: "reindent dot".to_string(), | 111 | label: "reindent dot".to_string(), |
113 | edit: TextEdit::replace(TextRange::new(offset - current_indent_len, offset), target_indent), | 112 | edit: TextEdit::replace(TextRange::new(offset - current_indent_len, offset), target_indent), |
114 | cursor_position: None, | ||
115 | }) | 113 | }) |
116 | } | 114 | } |
117 | 115 | ||
@@ -130,7 +128,6 @@ fn on_arrow_typed(file: &SourceFile, offset: TextSize) -> Option<SingleFileChang | |||
130 | Some(SingleFileChange { | 128 | Some(SingleFileChange { |
131 | label: "add space after return type".to_string(), | 129 | label: "add space after return type".to_string(), |
132 | edit: TextEdit::insert(after_arrow, " ".to_string()), | 130 | edit: TextEdit::insert(after_arrow, " ".to_string()), |
133 | cursor_position: None, | ||
134 | }) | 131 | }) |
135 | } | 132 | } |
136 | 133 | ||
diff --git a/crates/ra_ide_db/src/source_change.rs b/crates/ra_ide_db/src/source_change.rs index c64165f3a..94e118dd8 100644 --- a/crates/ra_ide_db/src/source_change.rs +++ b/crates/ra_ide_db/src/source_change.rs | |||
@@ -4,7 +4,7 @@ | |||
4 | //! It can be viewed as a dual for `AnalysisChange`. | 4 | //! It can be viewed as a dual for `AnalysisChange`. |
5 | 5 | ||
6 | use ra_db::{FileId, FilePosition, RelativePathBuf, SourceRootId}; | 6 | use ra_db::{FileId, FilePosition, RelativePathBuf, SourceRootId}; |
7 | use ra_text_edit::{TextEdit, TextSize}; | 7 | use ra_text_edit::TextEdit; |
8 | 8 | ||
9 | #[derive(Debug, Clone)] | 9 | #[derive(Debug, Clone)] |
10 | pub struct SourceChange { | 10 | pub struct SourceChange { |
@@ -109,7 +109,6 @@ pub enum FileSystemEdit { | |||
109 | pub struct SingleFileChange { | 109 | pub struct SingleFileChange { |
110 | pub label: String, | 110 | pub label: String, |
111 | pub edit: TextEdit, | 111 | pub edit: TextEdit, |
112 | pub cursor_position: Option<TextSize>, | ||
113 | } | 112 | } |
114 | 113 | ||
115 | impl SingleFileChange { | 114 | impl SingleFileChange { |
@@ -118,7 +117,7 @@ impl SingleFileChange { | |||
118 | label: self.label, | 117 | label: self.label, |
119 | source_file_edits: vec![SourceFileEdit { file_id, edit: self.edit }], | 118 | source_file_edits: vec![SourceFileEdit { file_id, edit: self.edit }], |
120 | file_system_edits: Vec::new(), | 119 | file_system_edits: Vec::new(), |
121 | cursor_position: self.cursor_position.map(|offset| FilePosition { file_id, offset }), | 120 | cursor_position: None, |
122 | is_snippet: false, | 121 | is_snippet: false, |
123 | } | 122 | } |
124 | } | 123 | } |