-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Range formatting doesn't appear to work #1125
Comments
Reproduced, fail to do formatting.
works as expected. Will debug on the first one. |
My usage with
with
another test, Have no idea why vim returns
|
Thank you for investigating! I confirm v:count is zero after running I will see if I can debug some more. I wonder if vim behaves similar. |
This is the key issue, have no idea why
The same. |
v:lnum and v:count are both correct in the I don't really know how the async stuff in typescript/nodejs interacts with neovim. But I think what we observe is a race condition. The value of |
@bombela Both |
What's the output of
:CocInfo
What's the output of
:CocCommand rust-analyzer.serverVersion
What's your coc-rust-analyzer version? You can get it from
:CocList extensions
In my coc-config I also have:
And
:echo CocHasProvider('formatRange')
returnsv:true
.(by the way,
"rust-analyzer.rustfmt.enableRangeFormatting": true
enables the feature but"rust-analyzer": { "rustfmt.enableRangeFormatting": true }
does not. Took me 45minutes to realize that).Then I do
:set formatexpr=CocAction('formatSelected')
. Now I expectgq
on a visual selection to format similar to RustFmt. Instead it formats the same as the default vim behavior.:CoInfo
reports nothing of interest besidesRequest action: formatSelected []
.As a baseline, I can compare with rustfmt nightly and
:'<,'>RustFmtRange
.Just to make sure things are happening at all, I can
:set formatexpr=CocAction('wontwork')
, and in this case it silently doesn't format anything. And:CoInfo
reportsRequest error: wontwork [] Error: Action "wontwork" not exist
.I can also
:set formatexpr=CocAction('format')
, which does indeed format the whole file like RustFmt, confirming again that something is really executed.So it appears that
CocAction('formatSelected')
with coc-rust-analyzer somehow falls-back to the default neovim formatting. I am not sure how to debug the issue further.The text was updated successfully, but these errors were encountered: