-
Notifications
You must be signed in to change notification settings - Fork 189
Closed
Description
Suppose I have the following code, where | is the point:
fn foo(foo_bar_baz1: i32, foo_bar_baz2: i32, foo_bar_baz3: i32, foo_bar_baz4: i32, foo_bar_baz5: i32, foo_bar_baz6: i32) {
}
fn bar() {|}
Calling M-x rust-format-buffer
naively moves to the same position after formatting, putting point in the arguments to foo
. It then calls rust--after-revert-hook
, which moves point to the start of the buffer.
Ideally, we'd use rustfmt's --write-mode=diff
so emacs-rustfmt could just apply the diff. Emacs' markers are smart enough to move if text is inserted before them. This is how gofmt is integrated with Emacs.
A simple partial fix would be to move to the same line number and column number as before -- this would handle more cases correctly.
dandavison and dsvensson
Metadata
Metadata
Assignees
Labels
No labels