Skip to content

code: highlight Go SSA .rules files; fix text padding - #43

Merged
achille-roussel merged 1 commit into
mainfrom
rules
May 27, 2026
Merged

code: highlight Go SSA .rules files; fix text padding#43
achille-roussel merged 1 commit into
mainfrom
rules

Conversation

@achille-roussel

Copy link
Copy Markdown
Contributor

Summary

  • Adds a chroma RegexLexer for the Go compiler's SSA rewrite-rule DSL (cmd/compile/internal/ssa/_gen/*.rules) and registers the .rules extension via the existing filename-fallback hook in the code package. Op names, <type> annotations, [auxint] / {aux} brackets, =>, &&, wildcards, and bindings each get their own token type.
  • Fixes a rendering bug in text.Text: lipgloss v2's Style.Render pads every line of a multi-line block to the longest line, and the trailing whitespace then wraps in narrow terminals — producing what looks like an empty line after every source line. Now renders one newline-delimited segment at a time, mirroring diff/diff.go.

Test plan

  • go build ./...
  • go test ./... — full suite green
  • TestRulesLexerTokens locks down the new lexer's token map
  • TestTextNoTrailingPadding regression-tests the padding fix
  • testdata/script/detect_rules.txtar covers CLI dispatch (ANSI on --color=always, byte-identical round-trip on --color=never)
  • Manual: stripes --color=always ~/go/src/.../ssa/_gen/Wasm3.rules renders highlighted with varying line lengths (no uniform padding)

🤖 Generated with Claude Code

…nder

Adds a chroma RegexLexer for the Go compiler's SSA rewrite-rule DSL
(cmd/compile/internal/ssa/_gen/*.rules) and routes the .rules extension
to it via the existing filename-fallback hook in the code package.

Also fixes a rendering bug in text.Text where lipgloss v2's Style.Render
pads every line of a multi-line block to the longest line, producing
trailing whitespace that wraps in narrow terminals and looks like an
empty line after every source line. Now renders one newline-delimited
segment at a time, mirroring diff/diff.go.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@achille-roussel
achille-roussel merged commit 038c599 into main May 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant