mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Add on-enter handler
Now, typing doc comments is much more pleasant
This commit is contained in:
parent
82447ecace
commit
2b956fd3a8
12 changed files with 630 additions and 401 deletions
|
@ -184,6 +184,12 @@ impl Analysis {
|
|||
let file = self.imp.file_syntax(file_id);
|
||||
SourceChange::from_local_edit(file_id, "join lines", ra_editor::join_lines(&file, range))
|
||||
}
|
||||
pub fn on_enter(&self, file_id: FileId, offset: TextUnit) -> Option<SourceChange> {
|
||||
let file = self.imp.file_syntax(file_id);
|
||||
let edit = ra_editor::on_enter(&file, offset)?;
|
||||
let res = SourceChange::from_local_edit(file_id, "on enter", edit);
|
||||
Some(res)
|
||||
}
|
||||
pub fn on_eq_typed(&self, file_id: FileId, offset: TextUnit) -> Option<SourceChange> {
|
||||
let file = self.imp.file_syntax(file_id);
|
||||
Some(SourceChange::from_local_edit(file_id, "add semicolon", ra_editor::on_eq_typed(&file, offset)?))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue