diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-09 17:52:48 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-10-09 17:52:48 +0100 |
commit | 31c8ebb743572ef07ac4ca77ddd17eddbcf4b24c (patch) | |
tree | 7a817485cf24ffe6e2acbec607115569bf3d8ac8 /crates/ra_analysis | |
parent | 14baf11bd41eb17cfee79fd7f9d068c4e785aa71 (diff) | |
parent | 2b956fd3a83313cee37ff179eae843bc88dd572a (diff) |
Merge #106
106: Add on-enter handler r=matklad a=matklad
Now, typing doc comments is much more pleasant
Co-authored-by: Aleksey Kladov <[email protected]>
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)?)) |