-
Notifications
You must be signed in to change notification settings - Fork 130
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
bug: fallback lsp range format modifies the wrong buffer #260
Comments
I found one way this could happen, but it's a race condition and the repro steps you're using don't look like they would trigger it. Worth giving it a shot anyway to see if this fixes it. Could you set Also, the error is just about the format changes being out of range. What makes you so certain that it's because the formatting is applied to the wrong buffer, as opposed to some other bug related to generating the text changes? |
Not seems to be a race condition for the issue, the log with DEBUG show three entry of LSP format both on a.cc:
The comments in the log is extra info add to show the operation what I have done at the time. And, updated the |
Well, seems I'm making a mistake in the format() wrapper by passing a table from module directly to different format() operations:
The The original
To fix that, make
|
Neovim version (nvim -v)
neovim: 0.9.5
conform: v5.1, commit: ad2b5ec
Operating system/version
archlinux latest
What is the severity of this bug?
breaking (some functionality is broken)
Steps To Reproduce
Provide two files:
a.cc
: maybe valid cpp source is enough, formatted or notb.cc
: lsp format will change the contentConfiguration:
clangd
lsp setup forcpp
Operations
nvim a.cc
b.cc
with:e b.cc
in nvimbug behavior base on the above operation:
For the conform format operation on
b.cc
:the first one may finish success, the latter format will raise Error without running the format callback:
Once
b.cc
get formatted,a.cc
get will be modified with extra empty(or maybe) lines. and b.cc will not be changed.Additional context
You may use the
lazyNvim: dev
branch to apply the test, use key shot for conform format operation. theformat()
wrapper is located ininit/utils.lua:format()
.The text was updated successfully, but these errors were encountered: