Skip to content

Commit 430bdd3

Browse files
committed
Run the main thread under the User Interactive QoS class
1 parent 578d994 commit 430bdd3

File tree

1 file changed

+8
-1
lines changed
  • crates/rust-analyzer/src/bin

1 file changed

+8
-1
lines changed

crates/rust-analyzer/src/bin/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,14 @@ fn try_main(flags: flags::RustAnalyzer) -> Result<()> {
7878
println!("rust-analyzer {}", rust_analyzer::version());
7979
return Ok(());
8080
}
81-
with_extra_thread("LspServer", stdx::thread::QoSClass::Utility, run_server)?;
81+
82+
// rust-analyzer’s “main thread” is actually a secondary thread
83+
// with an increased stack size at the User Initiated QoS class.
84+
// We use this QoS class because any delay in the main loop
85+
// will make actions like hitting enter in the editor slow.
86+
// rust-analyzer does not block the editor’s render loop,
87+
// so we don’t use User Interactive.
88+
with_extra_thread("LspServer", stdx::thread::QoSClass::UserInitiated, run_server)?;
8289
}
8390
flags::RustAnalyzerCmd::Parse(cmd) => cmd.run()?,
8491
flags::RustAnalyzerCmd::Symbols(cmd) => cmd.run()?,

0 commit comments

Comments
 (0)