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

Formatting results are occasionally applied to the wrong file #92

Closed
loganswartz opened this issue Aug 27, 2024 · 1 comment · Fixed by #93
Closed

Formatting results are occasionally applied to the wrong file #92

loganswartz opened this issue Aug 27, 2024 · 1 comment · Fixed by #93

Comments

@loganswartz
Copy link

When editing 2 or more different files, occasionally the formatting result from one file will be applied to the previous file instead of the current file. I think this issue is either related to, or the same as, both #58 and #71. However, unlike those 2 issues, I was able to create a mostly consistent minimal reproduction of the bug, which you can see here.

I added some further notes and observations in the README of that repo, but take them with a grain of salt, as I haven't exhaustively tested those speculations. That reproduction works pretty reliably for me, but since it seems to be timing related, you may have to coerce it into working on your environment by modifying the delays.

lukas-reineke added a commit that referenced this issue Aug 29, 2024
`vim.lsp.util.make_formatting_params` assumes the buffer the formatting
params are generated for is the current buffer. in LSP-format this is
not always the case.

fix #92
fix #58
@lukas-reineke
Copy link
Owner

Thanks for the reproduction repo
The issue was vim.lsp.util.make_formatting_params. It has 0 buffer hardcoded for generating the URI for the buffer. So even though the buffer numbers are correct, the URI was wrong..

I released a fix now

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

Successfully merging a pull request may close this issue.

2 participants