Repository navigation
Conversation
The PHP grammar parses anything outside <?php ... ?> as plain text nodes, so a code block without the opening tag — how models usually emit short PHP excerpts — produced zero highlightable nodes. Point the PHP entry at the php_only wasm variant, which treats the whole document as PHP; the bundled highlights query references no text or program nodes, and blocks that do open with <?php highlight identically under either parser.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 72 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
Thanks for the fix and for measuring the highlight ranges before and after, @Dopetaiga! I think this duplicates #58675, which is already open for #58664 and makes the same switch to One difference may matter: #58675 also replaces the highlights query with nvim-treesitter's |
Fixes #58664
Problem
The TUI shows PHP code blocks as plain text unless the snippet starts with
<?php. Root cause: the PHP grammar parses anything outside<?php ... ?>as plain text nodes, so a block without the opening tag — how models usually emit short PHP excerpts — parses to zero highlightable nodes. Other languages are unaffected because their grammars don't have this in-document tag structure.Fix
Point the PHP parser entry at the upstream
tree-sitter-php_only.wasmvariant (same release, v0.24.2), which treats the whole document as PHP code. Two reasons this is safe:text/programnodes, so it runs unchanged against the variant.<?phphighlight identically under either parser (measured below).One URL change plus the rationale comment; the query source is untouched.
Verification (local, driving
TreeSitterClientdirectly with the real wasm downloads)Highlighted ranges for the issue's snippet vs a tagged version, current parser vs the fix:
<?php<?phptree-sitter-php.wasm(current)tree-sitter-php_only.wasm(fix)packages/tuitypecheck (bun 1.4.4): no type errors across the package's projects.