Skip to content

feat(tui): add configurable syntax tokens for XML/HTML tags (#6128)#6130

Open
CasualDeveloper wants to merge 3 commits intoanomalyco:devfrom
CasualDeveloper:feat/syntax-tag-tokens
Open

feat(tui): add configurable syntax tokens for XML/HTML tags (#6128)#6130
CasualDeveloper wants to merge 3 commits intoanomalyco:devfrom
CasualDeveloper:feat/syntax-tag-tokens

Conversation

@CasualDeveloper
Copy link
Contributor

@CasualDeveloper CasualDeveloper commented Dec 24, 2025

Problem

XML/HTML tags use hardcoded color mappings tied to unrelated tokens (error, syntaxKeyword, syntaxOperator), preventing custom themes from controlling tag colours independently.

Solution

  • Add three optional theme tokens: syntaxTag, syntaxAttribute, syntaxTagDelimiter
  • Extract resolution logic into theme-resolver.ts for testability
  • Provide backward-compatible fallbacks to existing tokens
  • Cover fallback paths with unit tests

Related Items

Notes

  • Tests run locally via bun test test/cli/tui/theme.test.ts — all pass
  • Schema updated in packages/web/public/theme.json
  • Default theme updated in packages/opencode/src/cli/cmd/tui/context/theme/opencode.json
  • AI Assistance: OpenCode + openai/gpt-5.2-codex (high)
  • Testing: Unit tests + manual verification
  • Review: Human operator reviewed

Copilot AI review requested due to automatic review settings December 24, 2025 21:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds three optional theme tokens for XML/HTML syntax highlighting, allowing custom themes to independently control tag colors instead of inheriting from unrelated tokens. The implementation maintains backward compatibility by providing fallbacks to the original hardcoded color mappings.

  • Added syntaxTag, syntaxAttribute, and syntaxTagDelimiter as optional theme tokens
  • Updated type definitions to support the new tokens with proper fallback handling
  • Modified the opencode default theme to explicitly define colors for the new tokens

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/web/public/theme.json Added JSON schema definitions for the three new optional syntax token properties
packages/opencode/src/cli/cmd/tui/context/theme/opencode.json Defined explicit color values for the new tokens in the default opencode theme
packages/opencode/src/cli/cmd/tui/context/theme.tsx Updated TypeScript types, resolution logic, and syntax rules to support the new tokens with backward-compatible fallbacks

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CasualDeveloper
Copy link
Contributor Author

CasualDeveloper commented Dec 24, 2025

Re-committed with valid GPG signature. Closes #6128

@CasualDeveloper CasualDeveloper force-pushed the feat/syntax-tag-tokens branch 2 times, most recently from 925bc72 to ab80488 Compare December 26, 2025 06:51
@CasualDeveloper CasualDeveloper changed the title feat: add configurable syntax tokens for XML/HTML tags [#6128] feat: add configurable syntax tokens for XML/HTML tags Dec 26, 2025
@CasualDeveloper CasualDeveloper changed the title [#6128] feat: add configurable syntax tokens for XML/HTML tags [6128] feat: add configurable syntax tokens for XML/HTML tags Dec 26, 2025
@CasualDeveloper CasualDeveloper changed the title [6128] feat: add configurable syntax tokens for XML/HTML tags feat: add configurable syntax tokens for XML/HTML tags (#6128) Dec 26, 2025
@CasualDeveloper CasualDeveloper changed the title feat: add configurable syntax tokens for XML/HTML tags (#6128) feat(tui): add configurable syntax tokens for XML/HTML tags (#6128) Dec 26, 2025
@CasualDeveloper CasualDeveloper force-pushed the feat/syntax-tag-tokens branch 5 times, most recently from bfa7157 to fd61e1b Compare December 30, 2025 19:06
@CasualDeveloper
Copy link
Contributor Author

Will continue rebasing on top of release tags as they're set.

@CasualDeveloper CasualDeveloper force-pushed the feat/syntax-tag-tokens branch 5 times, most recently from 79c0686 to 3183087 Compare January 6, 2026 13:11
@CasualDeveloper CasualDeveloper force-pushed the feat/syntax-tag-tokens branch 7 times, most recently from 6173c3a to 7c36aef Compare January 12, 2026 08:50
@CasualDeveloper CasualDeveloper force-pushed the feat/syntax-tag-tokens branch 6 times, most recently from c954561 to 7fea6e5 Compare January 26, 2026 17:52
@CasualDeveloper CasualDeveloper force-pushed the feat/syntax-tag-tokens branch 6 times, most recently from 08a4d5a to 34189b4 Compare January 30, 2026 03:44
@thdxr thdxr force-pushed the dev branch 3 times, most recently from f1ae801 to 08fa7f7 Compare January 30, 2026 14:37
@CasualDeveloper CasualDeveloper force-pushed the feat/syntax-tag-tokens branch 4 times, most recently from 832c884 to e968064 Compare February 7, 2026 02:59
@CasualDeveloper CasualDeveloper force-pushed the feat/syntax-tag-tokens branch 4 times, most recently from 007348a to e31e7a4 Compare February 18, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add configurable syntax tokens for XML/HTML tag highlighting (#6130)

1 participant