language: Fix hang when editing certain tailwind class names (#40791)

Closes #36223

Upsteam issue to track:
https://github.com/tailwindlabs/tailwindcss-intellisense/issues/1479

Release Notes:

- Fixed an issue where Zed hanged when editing certain Tailwind class
names.
This commit is contained in:
Smit Barmase
2025-10-21 19:00:02 +05:30
committed by GitHub
parent 0eccdfe61f
commit cad06011c5
2 changed files with 7 additions and 1 deletions
+1
View File
@@ -67,6 +67,7 @@ tree-sitter.workspace = true
unicase = "2.6"
util.workspace = true
watch.workspace = true
zlog.workspace = true
diffy = "0.4.2"
[dev-dependencies]
+6 -1
View File
@@ -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