[X] You may also try reproduce the issue using clean environment using the following command: M-x lsp-start-plain
Bug description
In a rust project, executing a code action to fill match arms where the match statement contains lots of subelements is very slow, taking upwards of 10 seconds (or much more, depending on the size of the match expr). This does not correlate with the number of match arms, just the size of the overall match block.
Steps to reproduce
the following snippet can be used to recreate the slowness. Hover the cursor over true and call the Fill match arms code action. The exact contents of the block aren't relevant, just that there's a lot of stuff.
fn main() {
match true {
false => {
let q = 14;
// this line^ repeated ~600+ times
}
}
}
Expected behavior
The change should be instant/near-instant. I checked the speed of the action in vscode and in eglot to make sure it's not because of rust-analyzer itself, and it was an instant action in both.
Thank you for the bug report
lsp-mode
related packages.M-x lsp-start-plain
Bug description
In a rust project, executing a code action to fill match arms where the
match
statement contains lots of subelements is very slow, taking upwards of 10 seconds (or much more, depending on the size of thematch
expr). This does not correlate with the number of match arms, just the size of the overallmatch
block.Steps to reproduce
the following snippet can be used to recreate the slowness. Hover the cursor over
true
and call theFill match arms
code action. The exact contents of the block aren't relevant, just that there's a lot of stuff.Expected behavior
The change should be instant/near-instant. I checked the speed of the action in vscode and in eglot to make sure it's not because of
rust-analyzer
itself, and it was an instant action in both.Which Language Server did you use?
I was using
rust-analyzer
:OS
Linux
Error callstack
Anything else?
This probably isn't unique to rust-analyzer's
fill_match_arms
, but this is just where I happened to catch the bug.This situation is pretty likely to happen in rust when matching on enums with a large number of variants (e.g. a language's AST).