Implement Tree-sitter ZLE syntax highlighter #1

Open
opened 2026-09-28 13:09:19 -05:00 by mrnoname1000 · 0 comments
Owner

Objective

Implement the standalone Tree-sitter ZLE highlighter described in the approved design and implementation plan.

Scope

  • Zsh 5.9+ front end using zle-line-pre-redraw, with a persistent Zig helper per interactive session and no process spawn per edit.
  • Tree-sitter Zsh host highlighting and recursive static injections for Perl -e/-E and shell -c invocations (sh, Dash, Bash, Ksh, and Zsh).
  • POSIX sh grammar for sh/Dash, Bash grammar for Bash, and explicitly approximate Bash fallback for Ksh.
  • Default Zsh/Bash/POSIX sh/Perl grammars plus an explicitly installed, tiered optional grammar catalog.
  • Source-mapped spans without evaluating or executing entered command text.

Acceptance criteria

  • The plan's pre-implementation feasibility gate passes before product implementation: compile all four grammars with Zig, parse incomplete Zsh and the exact nested example sh -c 'zsh -c "perl -e print"', verify incremental requests reuse one worker process, and measure startup/memory/latency.
  • The complete and incomplete Zsh corpus, recursive-injection/source-map tests, UTF-8 and PREBUFFER span tests, ZLE lifecycle tests, and helper-failure/resource-limit tests pass.
  • The helper PID remains stable across edits, foreign region_highlight entries are preserved, and passive plugin loading performs no network access, build, command evaluation, or file creation.
  • Missing grammars disable only their injections; worker failures clear owned spans and do not break ZLE.

Execution constraints

Review the owning issue and branch from main as feature-<issue>. Use the approved subagent-driven execution method. Run the feasibility gate before product work; stop for review if it fails.

## Objective Implement the standalone Tree-sitter ZLE highlighter described in the approved design and implementation plan. - [Design specification](https://forgejo.unixtasty.com/mrnoname1000/treesitter4zsh/src/branch/main/docs/superpowers/specs/2026-09-27-tree-sitter-zsh-zle-highlighter-design.md) - [Implementation plan](https://forgejo.unixtasty.com/mrnoname1000/treesitter4zsh/src/branch/main/docs/superpowers/plans/2026-09-27-tree-sitter-zle-highlighter.md) ## Scope - Zsh 5.9+ front end using `zle-line-pre-redraw`, with a persistent Zig helper per interactive session and no process spawn per edit. - Tree-sitter Zsh host highlighting and recursive static injections for Perl `-e`/`-E` and shell `-c` invocations (`sh`, Dash, Bash, Ksh, and Zsh). - POSIX `sh` grammar for `sh`/Dash, Bash grammar for Bash, and explicitly approximate Bash fallback for Ksh. - Default Zsh/Bash/POSIX `sh`/Perl grammars plus an explicitly installed, tiered optional grammar catalog. - Source-mapped spans without evaluating or executing entered command text. ## Acceptance criteria - The plan's pre-implementation feasibility gate passes before product implementation: compile all four grammars with Zig, parse incomplete Zsh and the exact nested example `sh -c 'zsh -c "perl -e print"'`, verify incremental requests reuse one worker process, and measure startup/memory/latency. - The complete and incomplete Zsh corpus, recursive-injection/source-map tests, UTF-8 and `PREBUFFER` span tests, ZLE lifecycle tests, and helper-failure/resource-limit tests pass. - The helper PID remains stable across edits, foreign `region_highlight` entries are preserved, and passive plugin loading performs no network access, build, command evaluation, or file creation. - Missing grammars disable only their injections; worker failures clear owned spans and do not break ZLE. ## Execution constraints Review the owning issue and branch from `main` as `feature-<issue>`. Use the approved subagent-driven execution method. Run the feasibility gate before product work; stop for review if it fails.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
mrnoname1000/treesitter4zsh#1
No description provided.