Skip to content

Commit 5366538

Browse files
fix: remove hardcoded theme colors and rely on semanticTokenScopes (#9)
* Add TextMate grammar and remove hardcoded theme colors 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> * Remove sync-theme script and update theme.ts comment Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Remove dead buildVscodeRules export and fix template lone-brace tokenization - 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 * fix: remove TextMate grammar and fix decorator semantic token scope 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. * fix: restore buildVscodeRules export to avoid breaking external consumers --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent b98c087 commit 5366538

5 files changed

Lines changed: 6 additions & 218 deletions

File tree

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"typecheck": "turbo run typecheck",
1515
"clean": "turbo run clean",
1616
"extract-diagnostics": "tsx scripts/extract-diagnostics.ts",
17-
"sync-theme": "tsx scripts/sync-vscode-theme.ts",
1817
"dev": "turbo run dev --parallel",
1918
"docs:dev": "pnpm --filter @agentscript/docs dev",
2019
"docs:build": "pnpm --filter @agentscript/docs build",

packages/monaco/src/theme.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,8 @@
88
/**
99
* AgentScript theme color definitions — SINGLE SOURCE OF TRUTH.
1010
*
11-
* All syntax highlighting colors for both Monaco and VS Code are defined here.
12-
* Monaco imports these directly. VS Code's package.json is synced via:
13-
*
14-
* pnpm sync-theme
15-
*
16-
* Run that command after changing any colors here.
11+
* All syntax highlighting colors for Monaco are defined here.
12+
* Monaco imports these directly.
1713
*/
1814

1915
export interface TokenStyle {

packages/vscode/esbuild.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ function stageForPackaging() {
9797
cpSync(join(__dirname, 'icons'), join(stagingDir, 'icons'), {
9898
recursive: true,
9999
});
100-
101100
for (const file of [
102101
'LICENSE.txt',
103102
'CHANGELOG.md',

packages/vscode/package.json

Lines changed: 4 additions & 166 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
},
3030
"activationEvents": [],
3131
"scripts": {
32-
"prebuild": "tsx ../../scripts/sync-vscode-theme.ts",
3332
"build": "node esbuild.mjs",
3433
"dev": "node esbuild.mjs --watch",
3534
"typecheck": "tsc --noEmit",
@@ -81,16 +80,16 @@
8180
"constant.language.agentscript"
8281
],
8382
"string": [
84-
"string.quoted.agentscript"
83+
"string.quoted.double.agentscript"
8584
],
8685
"number": [
8786
"constant.numeric.agentscript"
8887
],
8988
"comment": [
90-
"comment.line.agentscript"
89+
"comment.line.number-sign.agentscript"
9190
],
9291
"namespace": [
93-
"entity.name.type.module.agentscript"
92+
"entity.name.namespace.agentscript"
9493
],
9594
"property": [
9695
"variable.other.property.agentscript"
@@ -99,7 +98,7 @@
9998
"keyword.operator.agentscript"
10099
],
101100
"decorator": [
102-
"string.regexp.decorator.agentscript"
101+
"support.function.agentscript"
103102
],
104103
"keyword.block": [
105104
"keyword.other.block.agentscript"
@@ -115,167 +114,6 @@
115114
"[agentscript]": {
116115
"editor.semanticHighlighting.enabled": true,
117116
"editor.bracketPairColorization.enabled": false
118-
},
119-
"editor.semanticTokenColorCustomizations": {
120-
"rules": {
121-
"keyword:agentscript": {
122-
"foreground": "#C586C0",
123-
"bold": true
124-
},
125-
"keyword.modification:agentscript": {
126-
"foreground": "#D7BA7D",
127-
"bold": true,
128-
"italic": true
129-
},
130-
"keyword.block:agentscript": {
131-
"foreground": "#569CD6",
132-
"bold": true
133-
},
134-
"keyword.blockName:agentscript": {
135-
"foreground": "#D7BA7D",
136-
"bold": false
137-
},
138-
"type:agentscript": "#4EC9B0",
139-
"function:agentscript": {
140-
"foreground": "#DCDCAA",
141-
"bold": true
142-
},
143-
"variable:agentscript": "#9CDCFE",
144-
"variable.readonly.defaultLibrary:agentscript": "#569CD6",
145-
"string:agentscript": "#CE9178",
146-
"number:agentscript": "#B5CEA8",
147-
"operator:agentscript": "#D4D4D4",
148-
"comment:agentscript": {
149-
"foreground": "#6A9955",
150-
"italic": true
151-
},
152-
"namespace:agentscript": "#4EC9B0",
153-
"property:agentscript": "#D4D4D4",
154-
"decorator:agentscript": "#E06C75"
155-
},
156-
"[Default Light+]": {
157-
"rules": {
158-
"keyword:agentscript": {
159-
"foreground": "#A626A4",
160-
"bold": true
161-
},
162-
"keyword.modification:agentscript": {
163-
"foreground": "#A626A4",
164-
"bold": true,
165-
"italic": true
166-
},
167-
"keyword.block:agentscript": {
168-
"foreground": "#0550AE",
169-
"bold": true
170-
},
171-
"keyword.blockName:agentscript": {
172-
"foreground": "#A626A4",
173-
"bold": false
174-
},
175-
"type:agentscript": "#0A6577",
176-
"function:agentscript": {
177-
"foreground": "#B45309",
178-
"bold": true
179-
},
180-
"variable:agentscript": "#24292F",
181-
"variable.readonly.defaultLibrary:agentscript": {
182-
"foreground": "#A626A4",
183-
"bold": true
184-
},
185-
"string:agentscript": "#A31415",
186-
"number:agentscript": "#7A3E00",
187-
"operator:agentscript": "#586069",
188-
"comment:agentscript": {
189-
"foreground": "#6B7783",
190-
"italic": true
191-
},
192-
"namespace:agentscript": "#A31415",
193-
"property:agentscript": "#111DFF",
194-
"decorator:agentscript": "#A31415"
195-
}
196-
},
197-
"[Default Light Modern]": {
198-
"rules": {
199-
"keyword:agentscript": {
200-
"foreground": "#A626A4",
201-
"bold": true
202-
},
203-
"keyword.modification:agentscript": {
204-
"foreground": "#A626A4",
205-
"bold": true,
206-
"italic": true
207-
},
208-
"keyword.block:agentscript": {
209-
"foreground": "#0550AE",
210-
"bold": true
211-
},
212-
"keyword.blockName:agentscript": {
213-
"foreground": "#A626A4",
214-
"bold": false
215-
},
216-
"type:agentscript": "#0A6577",
217-
"function:agentscript": {
218-
"foreground": "#B45309",
219-
"bold": true
220-
},
221-
"variable:agentscript": "#24292F",
222-
"variable.readonly.defaultLibrary:agentscript": {
223-
"foreground": "#A626A4",
224-
"bold": true
225-
},
226-
"string:agentscript": "#A31415",
227-
"number:agentscript": "#7A3E00",
228-
"operator:agentscript": "#586069",
229-
"comment:agentscript": {
230-
"foreground": "#6B7783",
231-
"italic": true
232-
},
233-
"namespace:agentscript": "#A31415",
234-
"property:agentscript": "#111DFF",
235-
"decorator:agentscript": "#A31415"
236-
}
237-
},
238-
"[Default High Contrast Light]": {
239-
"rules": {
240-
"keyword:agentscript": {
241-
"foreground": "#A626A4",
242-
"bold": true
243-
},
244-
"keyword.modification:agentscript": {
245-
"foreground": "#A626A4",
246-
"bold": true,
247-
"italic": true
248-
},
249-
"keyword.block:agentscript": {
250-
"foreground": "#0550AE",
251-
"bold": true
252-
},
253-
"keyword.blockName:agentscript": {
254-
"foreground": "#A626A4",
255-
"bold": false
256-
},
257-
"type:agentscript": "#0A6577",
258-
"function:agentscript": {
259-
"foreground": "#B45309",
260-
"bold": true
261-
},
262-
"variable:agentscript": "#24292F",
263-
"variable.readonly.defaultLibrary:agentscript": {
264-
"foreground": "#A626A4",
265-
"bold": true
266-
},
267-
"string:agentscript": "#A31415",
268-
"number:agentscript": "#7A3E00",
269-
"operator:agentscript": "#586069",
270-
"comment:agentscript": {
271-
"foreground": "#6B7783",
272-
"italic": true
273-
},
274-
"namespace:agentscript": "#A31415",
275-
"property:agentscript": "#111DFF",
276-
"decorator:agentscript": "#A31415"
277-
}
278-
}
279117
}
280118
},
281119
"configuration": {

scripts/sync-vscode-theme.ts

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)