GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(tui): highlight PHP blocks that do not open with <?php by Dopetaiga · Pull Request #58712 · anomalyco/opencode

Conversation

@Dopetaiga

@Dopetaiga Dopetaiga commented Oct 24, 2026

Copy link
Copy Markdown

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.wasm variant (same release, v0.24.2), which treats the whole document as PHP code. Two reasons this is safe:

  • The bundled highlights query references no text/program nodes, so it runs unchanged against the variant.
  • Blocks that do open with <?php highlight identically under either parser (measured below).

One URL change plus the rationale comment; the query source is untouched.

Verification (local, driving TreeSitterClient directly with the real wasm downloads)

Highlighted ranges for the issue's snippet vs a tagged version, current parser vs the fix:

parser block without <?php block with <?php
tree-sitter-php.wasm (current) 0 — the reported bug 7
tree-sitter-php_only.wasm (fix) 16 7

packages/tui typecheck (bun 1.4.4): no type errors across the package's projects.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Dopetaiga
fix(tui): highlight PHP blocks that do not open with <?php
17956fc
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.
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 24, 2026
@github-actions

github-actions Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@opencode-agent opencode-agent Bot closed this Oct 24, 2026
@opencode-agent

opencode-agent Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

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 tree-sitter-php_only.wasm.

One difference may matter: #58675 also replaces the highlights query with nvim-treesitter's php_only/highlights.scm. This PR keeps the existing tree-sitter-php query, which the code comment says is the one that works with this parser, and you showed it still highlights correctly. It would help a lot if you shared that finding on #58675, along with your results table, or tested that pull request's query change.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Dopetaiga Dopetaiga mentioned this pull request Oct 24, 2026
fix(tui): use php_only grammar for PHP syntax highlighting #58675
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

needs:compliance This means the issue will auto-close after 2 hours.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

tui: PHP code blocks without <?php are not syntax highlighted

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@Dopetaiga
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.