about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLuna Razzaghipour <lunarazzaghipour@gmail.com>2023-05-25 00:22:14 +1000
committerLuna Razzaghipour <lunarazzaghipour@gmail.com>2023-05-25 00:22:14 +1000
commit430bdd3509d9e188ec4904e2b5cd23e9f3e63e61 (patch)
treeecdb1e21bf99ab46a11ce57550e86d3288d9a809
parent578d99477ab4e01721372014c1fdaf3479fdf34d (diff)
downloadrust-430bdd3509d9e188ec4904e2b5cd23e9f3e63e61.tar.gz
rust-430bdd3509d9e188ec4904e2b5cd23e9f3e63e61.zip
Run the main thread under the User Interactive QoS class
-rw-r--r--crates/rust-analyzer/src/bin/main.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs
index 660a780eb03..3224aeae564 100644
--- a/crates/rust-analyzer/src/bin/main.rs
+++ b/crates/rust-analyzer/src/bin/main.rs
@@ -78,7 +78,14 @@ fn try_main(flags: flags::RustAnalyzer) -> Result<()> {
                 println!("rust-analyzer {}", rust_analyzer::version());
                 return Ok(());
             }
-            with_extra_thread("LspServer", stdx::thread::QoSClass::Utility, run_server)?;
+
+            // rust-analyzer’s “main thread” is actually a secondary thread
+            // with an increased stack size at the User Initiated QoS class.
+            // We use this QoS class because any delay in the main loop
+            // will make actions like hitting enter in the editor slow.
+            // rust-analyzer does not block the editor’s render loop,
+            // so we don’t use User Interactive.
+            with_extra_thread("LspServer", stdx::thread::QoSClass::UserInitiated, run_server)?;
         }
         flags::RustAnalyzerCmd::Parse(cmd) => cmd.run()?,
         flags::RustAnalyzerCmd::Symbols(cmd) => cmd.run()?,