• 
      

    Stop guessing tree-sitter languages for ambiguous file suffixes.

    Review Request #15252 — Created Aug. 25, 2026 and updated

    Information

    Review Board
    release-9.x

    Reviewers

    LANGUAGE_OVERRIDES only 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-suffix None
    behavior. Ran all treesitter and diffviewer tests.

    Summary ID
    Stop guessing tree-sitter languages for ambiguous file suffixes.
    `LANGUAGE_OVERRIDES` only 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. Testing: Added language detection tests for the XML family, OCaml interfaces, delimiter-separated files, Terraform, and the ambiguous-suffix None behavior. Ran all treesitter and diffviewer tests.
    sosvnrtsmznrqqntpynlkxvpnqkqvknu
    Checks run (2 succeeded)
    flake8 passed.
    JSHint passed.
    maubin
    1. Ship It!
    2.