rust-lang / rust-lang/rust-analyzer

Rust-analyzer freezes VS Code GUI when hovering over variable with long type

Open
#11,679 5 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-perf A-vscode C-enhancement E-unknown
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

I was testing a parser combinator library called chumsky and noticed that hovering over variables with very long types causes the whole VS Code to freeze for a couple of seconds before the pop up window appears. The CPU usage of VS Code jumps from 1% to 10% and the memory usage also spikes.
The repository is this, as you can see it's quite a small project. To replicate the performance problems just go to the bottom of parser.rs and hover over "definition".
My CPU is a AMD Ryzen 5 1600X 3.60Ghz and I have 8 GB of RAM.
Here you can see a video of VS Code freezing

https://user-images.githubusercontent.com/31445649/157887042-8b1a2e34-2f5d-4843-906d-3b8fb48d0db9.mp4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in parser.rs from the linked Sagrel/lang revision by hovering over "definition" at the bottom of the file. Start by profiling the hover path while observing the VS Code freeze and CPU or memory spike. Done means long Rust types no longer cause a multi-second GUI freeze before the hover popup appears.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.