fix: remove hardcoded theme colors and rely on semanticTokenScopes#9
Merged
Merged
Conversation
Adds packages/vscode/syntaxes/agentscript.tmLanguage.json with proper standard TextMate scope names so any VS Code theme (light or dark) colors AgentScript correctly without extension-defined overrides. - Add TextMate grammar covering all language constructs with standard scopes - Register grammar in package.json under contributes.grammars - Fix semanticTokenScopes to use correct standard scope names (string, comment, namespace, decorator were wrong) - Remove editor.semanticTokenColorCustomizations from configurationDefaults - Remove scripts/sync-vscode-theme.ts (no longer needed for VS Code) - Add syntaxes/ to esbuild staging so grammar is included in VSIX Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ization
- Remove buildVscodeRules from theme.ts and its re-export from index.ts;
its only consumer (sync-vscode-theme.ts) was deleted in the prior commit
- Fix TM grammar template pattern to consume lone { not followed by !,
preventing tokenizer stall on plain braces in template text
TextMate grammar was rejected as it cannot fully describe the AgentScript language. Syntax highlighting now relies entirely on semanticTokenScopes to map semantic token types to standard TM scope names, letting the active theme supply colors automatically for any light or dark theme. Also fixes the decorator scope from punctuation.definition.decorator to support.function so themes consistently color @action references.
awli
reviewed
Apr 22, 2026
| darkThemeColors, | ||
| lightThemeColors, | ||
| buildMonacoRules, | ||
| buildVscodeRules, |
Contributor
There was a problem hiding this comment.
I hope this isn't used in Monaco
awli
approved these changes
Apr 23, 2026
setu4993
approved these changes
Apr 23, 2026
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
The VS Code extension was hardcoding dark hex colors in
configurationDefaultsusing exact theme name matching. Anyone on a light theme or any third-party theme got dark colors on a white background. This removes all hardcoded colors and lets the active theme supply them automatically viasemanticTokenScopes.The
semanticTokenScopestable inpackage.jsonmaps each semantic token type (emitted by the LSP) to a standard TextMate scope name. VS Code looks those scopes up in the active theme and applies the theme's own colors — so any light, dark, high contrast, or third-party theme just works.Also removes
buildVscodeRulesfrom the Monaco package and thesync-themescript, which were only needed to generate the now-deleted hardcoded color block.Before
Default Light+,Default Light Modern,Default High Contrast Light— any other light theme brokeAfter
semanticTokenScopescovers all 13 token types the LSP emits with well-supported standard TM scope namesTesting
Manual verification:
.vsixinpackages/vscode/publish/after building:.agentfileCmd+K Cmd+Tand verify: