Repository navigation
fix(editor): highlight the text an editor opens with, and go plain past the size limit - #4392
Merged
Merged
Conversation
…st the size limit
…thin the size limit
datlechin
enabled auto-merge (squash)
November 21, 2026 08:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SourceEditor.makeControllerbuilds the controller with the bound text instead of""followed bytextView.setText. The SQL editor's coordinator loads the view inside the controller's init, so the highlighter was set up on"". Since perf: parse SQL off the main thread and shrink result rows #4340 the tree-sitter set up parses a snapshot taken at that moment, so it parsed""and every query came back empty. Every editor that opened with text, such as a restored tab or a file tab at window open, stayed uncolored on 0.88.0-beta.2.NSTextStorageentry point still swaps storage after init, and now rebuilds the highlighter when the view is already loaded.HighlightertreatsmaxHighlightableCharactersthe same way however the document got there. An edit past the limit leaves the whole document plain. Before, the old colors stayed and the provider's tree missed the edits. An edit back under the limit sets the providers up again from the current text instead of applying edits to a stale tree. A document over the limit is never parsed or queried:HighlightProviderStatesets its provider up only within the limit. A font or letter spacing change over the limit restyles the plain text without a query.maxHighlightableLengthis injected at init.HighlighterTestspasses it there instead of setting it after.Highlighter.setLanguagekeeps the new language, so a provider set up later uses it.Test plan
SourceEditorOpeningTextTests: bound text and a handed-over storage get highlights when a coordinator loads the view during init. Both fail on main, where the queries run against the tree for"".HighlighterLengthLimitTests: at the limit the document is highlighted; one character over leaves it plain and forwards no edit; back under sets the provider up again and colors it; a font change over the limit restyles the plain text without a query; a document that opens over the limit is set up only once it comes under it.mainunder lldb shows the client's state committed with one set up and no edits, the whole document marked valid, and a single empty style run.