Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
language: Fix hang when editing certain tailwind class names (#40791)
Smit Barmasecad06011c5c3
diff --git a/crates/language/Cargo.toml b/crates/language/Cargo.tomlindex b5524913bcc..bbbf9e31a5b 100644--- a/crates/language/Cargo.toml+++ b/crates/language/Cargo.toml@@ -67,6 +67,7 @@ tree-sitter.workspace = trueunicase = "2.6"util.workspace = truewatch.workspace = true+zlog.workspace = truediffy = "0.4.2"[dev-dependencies]diff --git a/crates/language/src/language.rs b/crates/language/src/language.rsindex fb523aeb9e8..2d1a2743812 100644--- a/crates/language/src/language.rs+++ b/crates/language/src/language.rs@@ -2589,7 +2589,12 @@ pub fn range_from_lsp(range: lsp::Range) -> Range<Unclipped<PointUtf16>> {let mut start = point_from_lsp(range.start);let mut end = point_from_lsp(range.end);if start > end {- log::warn!("range_from_lsp called with inverted range {start:?}-{end:?}");+ // We debug instead of warn so that this is not logged by default unless explicitly requested.+ // Using warn would write to the log file, and since we receive an enormous amount of+ // range_from_lsp calls (especially during completions), that can hang the main thread.+ //+ // See issue #36223.+ zlog::debug!("range_from_lsp called with inverted range {start:?}-{end:?}");mem::swap(&mut start, &mut end);}start..end