Skip to content
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

Support synchronous formatting #254

Open
calops opened this issue Jul 12, 2023 · 2 comments
Open

Support synchronous formatting #254

calops opened this issue Jul 12, 2023 · 2 comments

Comments

@calops
Copy link

calops commented Jul 12, 2023

I know, this has already been requested before (#108), and at the time it was judged better to implement locking formatting instead (#175), to prevent inadvertent buffer modification.

I do think however that there's still a use-case for synchronous formatting that isn't covered otherwise by the available options. When I save my file, my LSP is running diagnostics on everything. This can be a heavy process that takes a while. If the formatting happens after the writing, then the diagnostics won't correspond to the lines in my buffer, unless I save again (and start the whole checking process again, making the feedback loop even longer).

So, in order to have a proper BufWritePre hook that formats before anything is saved, synchronous formatting is the only solution I see.

I'll understand if you think this is out of scope for this plugin, but I thought I would offer another perspective for how this feature that almost got implemented (#109) could be useful.

@mibmo
Copy link

mibmo commented Nov 22, 2023

Yeah I would still like this too - it's quite annoying to have to run the formatter twice and not supporting formatting on :x/:wq is a PITA too.

@igor-ribeiro
Copy link

Any updates here? Support for BufWritePre would be awesome to avoid having to double undo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants