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

textDocument/formatting takes much longer than cargo fmt #1726

Closed
YaLTeR opened this issue Aug 22, 2019 · 6 comments
Closed

textDocument/formatting takes much longer than cargo fmt #1726

YaLTeR opened this issue Aug 22, 2019 · 6 comments
Labels
E-unknown It's unclear if the issue is E-hard or E-easy without digging in

Comments

@YaLTeR
Copy link

YaLTeR commented Aug 22, 2019

I'm using rust-analyzer cd24349 with autozimu/LanguageClient-neovim@12e65e7.

Running :call LanguageClient_textDocument_formatting() takes a really long while (upwards of 30 seconds on files from rav1e, like src/api/mod.rs), even though cargo fmt completes in half a second.

@matklad matklad added the E-unknown It's unclear if the issue is E-hard or E-easy without digging in label Sep 6, 2019
@matklad
Copy link
Member

matklad commented Sep 6, 2019

That seems pretty strage. For document formatting, we just shell out to rustfmt, so my best guess is that something weird is going on in the environment. I don't have a better advice than to just try to debug this issue.

@YaLTeR
Copy link
Author

YaLTeR commented Sep 6, 2019

How do I go about debugging this?

@YaLTeR
Copy link
Author

YaLTeR commented Jan 6, 2020

I noticed the same behavior in RLS: on some projects formatting via the request just takes a while for some reason. Maybe it's the language client that is to blame here.

@abbec
Copy link

abbec commented Jan 15, 2021

I also get this when the lsp server has just been started and still has high CPU usage. After a while it settles though and becomes instant

@lnicola
Copy link
Member

lnicola commented Jan 15, 2021

Maybe it's queued in the event loop?

@lnicola
Copy link
Member

lnicola commented Jan 27, 2021

Let's close this as a dupe of #4054 (which is newer, but has more discussion and an arguably better title).

@lnicola lnicola closed this as completed Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-unknown It's unclear if the issue is E-hard or E-easy without digging in
Projects
None yet
Development

No branches or pull requests

4 participants