anomalyco / anomalyco/opencode

[BUG]: No Swift syntax highlighting — highlights.scm from main is incompatible with pinned tree-sitter-swift 0.7.1 wasm

Open
#46,707 0 comments 0 reactions 1 assignee View on GitHub

@kommander is already working on this.

Since Sep 2, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description


about: Swift files get no syntax highlighting in the TUI because the pinned parser and the fetched highlights query are incompatible
labels: ["bug"]
title: "[BUG]: No Swift syntax highlighting — highlights.scm from main is incompatible with pinned tree-sitter-swift 0.7.1 wasm"

Description

Swift files get no syntax highlighting in the TUI (file views, diffs, code blocks). The TUI silently falls back to plain text.

Root cause: parsers-config.ts pins the Swift parser wasm to tree-sitter-swift 0.7.1 but fetches highlights.scm from the grammar repo's main branch:

{
  filetype: "swift",
  wasm: "https://github.com/alex-pinkus/tree-sitter-swift/releases/download/0.7.1/tree-sitter-swift.wasm",
  queries: {
    highlights: [
      "https://raw.githubusercontent.com/alex-pinkus/tree-sitter-swift/main/queries/highlights.scm",
    ],
    ...
  },
}

main's highlights query has drifted from the 0.7.1 parser (e.g. it references a nil_literal node that doesn't exist in 0.7.1), so the query fails to compile and highlighting for the whole language is dropped. I verified this directly with web-tree-sitter 0.25.8:

  • wasm 0.7.1 + main's highlights.scmQUERY COMPILE FAILED: Bad node name 'nil_literal'
  • wasm 0.7.1 + 0.7.1-tagged highlights.scm → compiles and matches fine

This is the same wasm/query version-mismatch pattern flagged in review on #43496 ("swift (wasm 0.7.1 vs highlights 0.7.3)"), which is still unfixed on dev as of today.

Suggested fix: pin the highlights query to the 0.7.1 tag (one-line change), or bump the wasm to a release that matches main's queries.

Plugins

none

OpenCode version

1.18.25

Steps to reproduce
  1. Open any .swift file in the TUI (or view a diff / a ```swift code block)
  2. Observe the text renders unhighlighted while other languages (Go, Rust, Python, ...) are highlighted
Screenshot and/or share link

n/a

Operating System

macOS 15.5

Terminal

Ghostty

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.