From a8241193676afba1ceef2aa423b35473177c6be1 Mon Sep 17 00:00:00 2001 From: Remco Smits Date: Wed, 21 May 2025 01:37:09 +0200 Subject: [PATCH] Fix performance issues in project search related to detecting JSX tag auto-closing (#30842) This PR changes it so we only create a snapshot and get the syntax tree for a buffer if we didn't detect that auto_close is enabled. Screenshot 2025-05-16 at 21 10 28 Release Notes: - Improved project search performance --- crates/editor/src/jsx_tag_auto_close.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/editor/src/jsx_tag_auto_close.rs b/crates/editor/src/jsx_tag_auto_close.rs index 3a181f8e32..e669a59513 100644 --- a/crates/editor/src/jsx_tag_auto_close.rs +++ b/crates/editor/src/jsx_tag_auto_close.rs @@ -316,6 +316,10 @@ pub(crate) fn refresh_enabled_in_any_buffer( let multi_buffer = multi_buffer.read(cx); let mut found_enabled = false; multi_buffer.for_each_buffer(|buffer| { + if found_enabled { + return; + } + let buffer = buffer.read(cx); let snapshot = buffer.snapshot(); for syntax_layer in snapshot.syntax_layers() {