-
Notifications
You must be signed in to change notification settings - Fork 184
rustfmt should display errors #204
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I've tried to solve this with ;; Formatting using rustfmt
(defun rust--format-call (buf)
"Format BUF using rustfmt."
(let ((fmt-buffer (get-buffer-create "*rustfmt*")))
(with-current-buffer fmt-buffer
(let ((buffer-read-only nil))
(erase-buffer)
(insert-buffer-substring buf)
(let ((ret (shell-command-on-region (point-min) (point-max)
rust-rustfmt-bin fmt-buffer
nil)))
(cond
((zerop ret)
(if (not (string= (buffer-string)
(with-current-buffer buf (buffer-string))))
(copy-to-buffer buf (point-min) (point-max)))
(kill-buffer)
(message "Formatted buffer with rustfmt."))
(t
(let ((path (buffer-file-name buf)))
(goto-char (point-min))
(save-excursion
(while (re-search-forward "stdin" nil t)
(replace-match path))
(compilation-mode)
(pop-to-buffer fmt-buffer))
(message "Rustfmt could not format some lines.")))))))))
|
All I really know is that |
This was added some time ago and can be used with the option |
Oh maybe I'm wrong, I'll better check. It just looked like it was implemented... |
If you run rustfmt and it errors out, it currently just "beeps" and suggests you switch over to
*rustfmt*
. I think this should be treated like a failed compilation; we should split the frame into two windows, show the errors, and let you useM-x next-error
to view them.Example 1, which errors because it doesn't parse:
Example 2, undefined module:
Example 3, long lines:
The text was updated successfully, but these errors were encountered: