Stop guessing tree-sitter languages for ambiguous file suffixes.
Review Request #15252 — Created Aug. 25, 2026 and updated
LANGUAGE_OVERRIDESonly covered .h, .js, .scm, .ts, and .xml. For
every other suffix with multiple candidate grammars, the
alphabetically-first one won: .svg/.xsd/.xsl/.xslt/.rng files were
parsed with the dtd grammar (rendering garbage), .mli went to ocaml
instead of ocaml_interface, .tsv/.psv went to csv, and .tf/tfvars went
to hcl. Since a non-None language blocks the Pygments fallback, these
file types regressed compared to Pygments-only highlighting.Overrides are now defined for every ambiguous suffix with a clear
answer. Suffixes that are genuinely ambiguous (.m, .pp, .cls, .bb, .vsh)
return None so Pygments, which has content-based detection, can decide
instead.
Added language detection tests for the XML family, OCaml interfaces,
delimiter-separated files, Terraform, and the ambiguous-suffixNone
behavior. Ran all treesitter and diffviewer tests.
| Summary | ID |
|---|---|
| sosvnrtsmznrqqntpynlkxvpnqkqvknu |