Repository navigation
Version v2.5.0
Configurable parser per file extension
chunking.parsers maps a file extension to a parser (chunker) language, so the
extension → parser mapping is no longer hard-coded:
{
"chunking": {
"parsers": {
".c": "cpp",
".cu": "cpp"
}
}
}Keys normalize (lowercased, leading dot added), so "CXX" and ".cxx" are the
same entry. Values must be a registered parser language (typescript, cpp,
python, … plus text for the fallback parser) — unknown names surface as
config warnings listing the valid ones. Both new extensions and existing
mappings can be remapped.
The override is resolved per call and never mutates the process-wide chunker
registry, so it stays workspace-scoped and coexists safely with pluggable
chunkers[]. It applies consistently to indexing/chunking, get_file_skeleton
(plugin tool and MCP), read-tool code fences and the embedding metadata header.
Extensions named in the map are implicitly added to the scanned set.
Set it in opencode-rag.json, in the TUI settings editor (Chunking → Parser
overrides), or via the dashboard API (PUT /api/config). opencode-rag init
now emits an empty chunking section so the key is discoverable.
Fixes
- The TUI's live parser-override edit was a silent dead write —
applyRuntimeOverrides()had nochunkingbranch, so the change never took
effect. - The runtime-override reload interval had drifted from the documented 5s to
1h, which made every "live" TUI edit look broken. - The embedding metadata header kept its own extension → label table, so a
remapped.cfile was embedded as[c]while its chunk language wascpp. - The eval fast-indexer dropped the parser and node-type overrides, so eval
chunk boundaries diverged from production. PUT /api/confignow accepts achunkingsection.- A no-op override (
.tsx→typescript) no longer degrades the skeleton
recipe — the extension keeps its own, more specific recipe.
Note: changing a mapping changes chunk boundaries for already-indexed
files without changing their content hashes. Re-run
opencode-rag index --forceafter editing.
Closes #29.
Full Changelog: v2.4.5...v2.5.0