code: highlight Go SSA .rules files; fix text padding - #43
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
RegexLexerfor the Go compiler's SSA rewrite-rule DSL (cmd/compile/internal/ssa/_gen/*.rules) and registers the.rulesextension via the existing filename-fallback hook in thecodepackage. Op names,<type>annotations,[auxint]/{aux}brackets,=>,&&, wildcards, and bindings each get their own token type.text.Text: lipgloss v2'sStyle.Renderpads 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, mirroringdiff/diff.go.Test plan
go build ./...go test ./...— full suite greenTestRulesLexerTokenslocks down the new lexer's token mapTestTextNoTrailingPaddingregression-tests the padding fixtestdata/script/detect_rules.txtarcovers CLI dispatch (ANSI on--color=always, byte-identical round-trip on--color=never)stripes --color=always ~/go/src/.../ssa/_gen/Wasm3.rulesrenders highlighted with varying line lengths (no uniform padding)🤖 Generated with Claude Code