-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow formatter using 'filepath on a modified buffer #110
Conversation
'filepath is supposed to indicate that the formatter doesn’t actually read from the named file, meaning it’s safe to use on a modified buffer. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Fixes radian-software#109. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
0be4131
to
e050722
Compare
I don't think this is a good idea. The restriction from formatting when the buffer is modified is because it assumes the formatter is formatting the file, not the buffer, and then when we try to apply the changes atop the buffer because it doesn't match what was there before formatting there could be some discrepencies. That said I'm also not a big fan of the current state of this. It might be better to add an option to auto-save the buffer before running the formatter or add a new field (aside from filepath) which indicates to apheleia "yes, this uses the filepath, but it still formats through stdin". |
Lines 959 to 961 in 12804a5
Also, I consider it very important that formatting a buffer does not save it. For me, formatting is as integral to the editing experience as pressing the space bar, and I would never want an editor that auto-saved every time I pressed the space bar. |
I can see this argument and I'm kinda in favour of it. The thought of making the formatting run more transparently during typing is an interesting one. |
You're right. There is no need to block formatting on a modified buffer for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
Fixes #109.