-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Closed
Copy link
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)
Description
Syntax highlighting does not work for Kotlin, HCL, Lua, and TOML
Description
Tree-sitter parser support for syntax highlighting in the TUI for the following languages is missing:
- Kotlin
- HCL
- Lua
- TOML
Screenshot
Proposed Fix
Each language needs:
- A Tree-sitter wasm binary (from tree-sitter-grammars org or language-specific releases)
- Highlight queries (from nvim-treesitter or the grammar repo)
- Optional: locals queries for variable tracking
Implementation
Added parser entries in packages/opencode/parsers-config.ts:
| Language | Wasm Source | Queries |
|---|---|---|
| kotlin | fwcd/tree-sitter-kotlin v0.3.8 | fwcd kotlin highlights + nvim-treesitter locals |
| hcl | tree-sitter-grammars/tree-sitter-hcl v1.2.0 | nvim-treesitter hcl highlights |
| lua | tree-sitter-grammars/tree-sitter-lua v0.5.0 | tree-sitter-grammars lua highlights + locals |
| toml | tree-sitter-grammars/tree-sitter-toml v0.7.0 | nvim-treesitter toml highlights |
Verification
Restart OpenCode after updating. Tested with kotlin, hcl, lua, toml fenced code blocks in markdown.
Checklist
- Added parser entries for kotlin, hcl, lua, toml
- Verified typecheck passes
- Tested in TUI after restart
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)