-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Saving while continueing to edit the buffer overwrites the post-save changes #21
Comments
Seems like this can be corrected with |
That's probably a decent idea anyway, but i can equally repro by saving then quickly pasting or doing other normal mode things. Ideally it would no-op if the state of the buffer had changed at all from the savepoint, although i dont know the practicality of doing so. |
This is by design, it is unrelated to
It should do that. I use |
Can you test if #22 fixes the issue? |
I believe i'm still seeing it happen |
Are you sure? I can't reproduce it anymore. |
I release #22 now, but please open the issue again if you can still reproduce it. |
I switched back to master and can confirm that my git log contains the commit. I dont know if there's a way for me to manually verify that it's being picked up correctly. But the above example repro behaves similarly, but not the same Kapture.2022-03-07.at.09.25.20.mp4 |
hm, can you add some logging to try to debug this? Can you print the output of lsp-format.nvim/lua/lsp-format/init.lua Lines 24 to 28 in 68f6165
print(vim.api.nvim_get_mode().mode)
if
vim.api.nvim_buf_get_var(ctx.bufnr, "format_changedtick")
== vim.api.nvim_buf_get_var(ctx.bufnr, "changedtick")
and not vim.startswith(vim.api.nvim_get_mode().mode, "i")
then |
Okay, adding the print (or rather vim.notify) actually lead me down a path. I think your pr did fix it, it just wasn't being picked up despite the on-disk code being changed. some combination of packercompile and lua caching which i cleared eventually made the notify show up and it now seems to be working. Sorry for the false alarm! I was esp thrown off by the seemingly different behavior to what i was seeing originally. |
Kapture.2022-03-04.at.12.55.37.mp4
The actual buffer that gets saved seems to be the pre-format version, which makes sense because of the fact that it's using BufWritePost (btw, could it possibly be BufWritePre, so that one ends up with an unedited buffer after saving), fwiw.
The text was updated successfully, but these errors were encountered: