Add syntax highlighting support for Clojure (.clj) files
Feature Request: Clojure (.clj) Syntax Highlighting Support
Problem
OpenCode currently does not provide syntax highlighting for Clojure (.clj) files. When viewing diffs for .clj files, they appear as plain text without any color/syntax highlighting, making them difficult to read and review.
Proposed Solution
Add syntax highlighting support for Clojure (.clj) files by:
-
Integrate Tree-sitter Clojure grammar: Add
tree-sitter-clojuregrammar to OpenTUI -
File extension recognition: Update file type detection to recognize
.cljfiles - Syntax highlighting rules: Create Tree-sitter queries for Clojure syntax elements
- Theme integration: Map Clojure syntax constructs to existing theme properties
Implementation Details
- Location: Changes needed in both OpenTUI (core syntax highlighting) and OpenCode (file type detection)
- Framework: Use existing Tree-sitter-based syntax highlighting system
- Compatibility: Ensure integration with existing diff highlighting and theme system
Use Case
Clojure developers would benefit from proper syntax highlighting when:
- Reviewing code changes in diffs
- Reading Clojure source files
- Identifying syntax elements (functions, macros, special forms, etc.)
- Improving overall code readability and developer experience
Additional Context
Clojure is a mature Lisp dialect with a growing ecosystem. Adding support would make OpenCode more inclusive for the Clojure community and align with the goal of supporting a wide range of programming languages.
The existing theme system already has the necessary properties (syntaxComment, syntaxKeyword, syntaxFunction, etc.) that can be mapped to Clojure syntax elements.
i think someone said they got this working so i think i can merge their pr
Should be closed when this https://github.com/sst/opencode/pull/3912 is merged