diff options
author | Aleksey Kladov <[email protected]> | 2018-10-09 14:00:20 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-10-09 17:52:06 +0100 |
commit | 2b956fd3a83313cee37ff179eae843bc88dd572a (patch) | |
tree | a1010728cfc8018e5f62152f4c45b9523f8d5e25 /crates/ra_analysis | |
parent | 82447ecacef9129a44d3c17b3db7a0e60a7ec92b (diff) |
Add on-enter handler
Now, typing doc comments is much more pleasant
Diffstat (limited to 'crates/ra_analysis')
-rw-r--r-- | crates/ra_analysis/src/lib.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crates/ra_analysis/src/lib.rs b/crates/ra_analysis/src/lib.rs index b4c7db476..f6ceb7eb2 100644 --- a/crates/ra_analysis/src/lib.rs +++ b/crates/ra_analysis/src/lib.rs | |||
@@ -184,6 +184,12 @@ impl Analysis { | |||
184 | let file = self.imp.file_syntax(file_id); | 184 | let file = self.imp.file_syntax(file_id); |
185 | SourceChange::from_local_edit(file_id, "join lines", ra_editor::join_lines(&file, range)) | 185 | SourceChange::from_local_edit(file_id, "join lines", ra_editor::join_lines(&file, range)) |
186 | } | 186 | } |
187 | pub fn on_enter(&self, file_id: FileId, offset: TextUnit) -> Option<SourceChange> { | ||
188 | let file = self.imp.file_syntax(file_id); | ||
189 | let edit = ra_editor::on_enter(&file, offset)?; | ||
190 | let res = SourceChange::from_local_edit(file_id, "on enter", edit); | ||
191 | Some(res) | ||
192 | } | ||
187 | pub fn on_eq_typed(&self, file_id: FileId, offset: TextUnit) -> Option<SourceChange> { | 193 | pub fn on_eq_typed(&self, file_id: FileId, offset: TextUnit) -> Option<SourceChange> { |
188 | let file = self.imp.file_syntax(file_id); | 194 | let file = self.imp.file_syntax(file_id); |
189 | Some(SourceChange::from_local_edit(file_id, "add semicolon", ra_editor::on_eq_typed(&file, offset)?)) | 195 | Some(SourceChange::from_local_edit(file_id, "add semicolon", ra_editor::on_eq_typed(&file, offset)?)) |