fix: map .tsx files to tsx grammar instead of typescript#22
Conversation
.tsx files contain JSX syntax which the typescript tree-sitter grammar cannot parse, resulting in 25+ parse errors per file and dropped symbols in the repo map. The tsx grammar is a strict superset of typescript and handles both correctly (0 errors vs 25 on real-world TSX files). .ts files are unchanged and continue to use the typescript grammar.
|
aider is still not able to parse and build the repomap correctly, and needs another fix for this to work because There's a typescript-tags.scm but no tsx-tags.scm. When the grammar is now tsx, aider looks for tsx-tags.scm, finds nothing, and extracts 0 tags The grammar fix (tsx vs typescript) correctly parses JSX with 0 errors, but the SCM query doesn't know to look for arrow-function-style component definitions. That's a query gap that exists for .ts files too, not just .tsx. To fix it properly, the tsx-tags.scm (or typescript-tags.scm) needs an additional pattern like: (variable_declarator That would capture export const HealthBadge = ({ score }) => ..., export const KPICard = ..., etc. This is a genuine query enhancement — it would need to go into aider as a new or updated SCM file, and also be tested against .ts files to make sure it doesn't produce false positives (e.g. capturing every const x = () => not just exported ones). The exported-only version would need: (export_statement This would have to be a change in the aider repository |
.tsx files contain JSX syntax which the typescript tree-sitter grammar cannot parse, resulting in 25+ parse errors per file and dropped symbols in the repo map. The tsx grammar is a strict superset of typescript and handles both correctly (0 errors vs 25 on real-world TSX files).
.ts files are unchanged and continue to use the typescript grammar.
Fixes #21