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

Autoformat not running when exiting neovim with :wq #308

Open
mikerowehl opened this issue Jul 29, 2021 · 0 comments
Open

Autoformat not running when exiting neovim with :wq #308

mikerowehl opened this issue Jul 29, 2021 · 0 comments

Comments

@mikerowehl
Copy link

Do you want to request a feature or report a bug?
bug

What is the current/expected behavior?
It appears that the async job in neovim isn't always working correctly when running as part of an autocommand. I have vim-prettier setup to autoformat. And generally everything works, if I manually trigger prettier or save the buffer without exiting everything works. But if I exit with :wq the file isn't formatted.

I saw some bugs in older issues related to similar situations, so I dug around a bit. Cranked up debugging in neovim and saw that the prettier#Autoformat function was getting called and it did seem to be starting the executable. Just never updating the file. So I changed the first argument of the prettier#Prettier function to a 0 instead of a 1 within that prettier#Autoformat function and files started saving as expected.

At first I was testing this with a locally compiled neovim (v0.6.0-dev+84-gac5139eae), but I've also tried with the v0.5.0 release from Homebrew and saw the same behavior.

What version of vim-prettier are you using - (output of :PrettierVersion) ?
1.0.0-beta

What version of prettier are you using - (output of :PrettierCliVersion) ?
2.3.2

What is your prettier executable path - (output of :PrettierCliPath) ?
prettier

Did this work in previous versions of vim-prettier and/or prettier ?
I'm not sure, this is my first setup for both.

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

1 participant