intellij-rust / intellij-rust

Rust plugin for the IntelliJ Platform
https://intellij-rust.github.io
MIT License
4.53k stars 380 forks source link

`Insert imports on paste` causes IDE freezes #9664

Open Undin opened 1 year ago

Undin commented 1 year ago

Environment

Problem description

Insert imports on paste feature (Preferences | Editor | General | Auto Import | Rust settings) introduced in #7597 leads to execution of resolve-related code in EDT. As a result, if a user pastes large fragment of code, IDE may freeze.

Not to affect users, the option is disabled by default now but it would be nice to fix it by moving execution of name resolution into background thread

Large file for testing: https://github.com/apache/arrow-rs/blob/master/arrow-cast/src/cast.rs

dima74 commented 1 year ago

So the plan is: