fix(editor): restore correct SQL string color across all themes#192
Merged
Conversation
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.
Problem
SQL string literals (single-quoted values like 'foo') were rendering in a barely-readable dark
red in the Monaco editor for all themes (most visible in Dracula).
Root cause: Monaco's built-in SQL tokenizer sets tokenPostfix: ".sql", which means the token type
for SQL strings is string.sql, not string. Monaco 0.55 does not reliably fall back from
string.sql to the generic string rule, so SQL strings received no color override and fell through
to the base theme's unmatched-token rendering — a dark red on dark backgrounds.
Fix
Added an explicit string.sql token rule to every bundled Monaco theme JSON, using the same color
already defined for the generic string rule. Also updated generateMonacoTheme() in themeUtils.ts
to inject string.sql / string.quote.sql rules for themes that don't have a JSON file (Tabularis
Dark, Tabularis Light, High Contrast).
#f1fa8c#e6db74#a3be8c#79b8ff#032f62#addb67#98c379#2aa198#99cc99Testing
Open the SQL console, select any theme, and type a query with a single-quoted string literal — it
should render in the theme's string color instead of red.