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.

<img width="1205" alt="Screenshot 2025-05-16 at 21 10 28"
src="https://github.com/user-attachments/assets/1ada445f-77bc-4c7c-bffe-953f34ee5384"
/>


Release Notes:

- Improved project search performance
This commit is contained in:
Remco Smits 2025-05-21 01:37:09 +02:00 committed by GitHub
parent 16366cf9f2
commit a824119367
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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() {