Skip to content

language: Only block the foreground on buffer reparsing when necessary#43888

Merged
Veykril merged 1 commit intomainfrom
push-tzwvtswzokvs
Dec 1, 2025
Merged

language: Only block the foreground on buffer reparsing when necessary#43888
Veykril merged 1 commit intomainfrom
push-tzwvtswzokvs

Conversation

@Veykril
Copy link
Member

@Veykril Veykril commented Dec 1, 2025

Gist is we only need to block the foreground thread for reparsing if immediate language changes are useful to the user. That is usually only the case when they edit the buffer

Release Notes:

  • Improved performance of large project searches and project diffs

Co-authored by: David Kleingeld david@zed.dev

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 1, 2025
@Veykril Veykril force-pushed the push-tzwvtswzokvs branch 3 times, most recently from 452b2bb to 0b82d75 Compare December 1, 2025 13:17
@Veykril Veykril merged commit 9af6e82 into main Dec 1, 2025
23 checks passed
@Veykril Veykril deleted the push-tzwvtswzokvs branch December 1, 2025 13:57
@maxbrunsfeld
Copy link
Collaborator

maxbrunsfeld commented Dec 1, 2025

The methods that are used in many places base became set_language_immediate and with_language_immediate, and the one with only a few call sites kept the intuitive name set_language.

Naming-wise, I think it's a bit odd to allow the name to be dominated by this term "immediate" that is just about a very subtle optimization. It'd be nice to have the frequently-used method keep the regular name set_language.

Could the buffer manage the may_block boolean automatically internally, by recording whether its syntax-highlighted text has ever been requested? That seems like it captures the intent behind the change, looking at the call sites. Alternatively, should we set the may_block state with some more explicit stateful API, where the editor tells the buffer that it is currently focused?

Veykril added a commit that referenced this pull request Dec 1, 2025
…ion (#43915)

cc
#43888 (comment)

Release Notes:

- N/A *or* Added/Fixed/Improved ...
someone13574 pushed a commit to someone13574/zed that referenced this pull request Dec 16, 2025
zed-industries#43888)

Gist is we only need to block the foreground thread for reparsing if
immediate language changes are useful to the user. That is usually only
the case when they edit the buffer

Release Notes:

- Improved performance of large project searches and project diffs

Co-authored by: David Kleingeld <david@zed.dev>
someone13574 pushed a commit to someone13574/zed that referenced this pull request Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants