queries/jjdescription: highlight the body as text, not as a string - #16172
Open
lukehsiao wants to merge 1 commit into
Open
queries/jjdescription: highlight the body as text, not as a string#16172lukehsiao wants to merge 1 commit into
lukehsiao wants to merge 1 commit into
Conversation
The query captures the entire message body as `@string`. `jjdescription` was added by copying git-commit's language rules, but the two queries disagree about the part you actually type: git-commit leaves the body uncaptured so it renders as `ui.text`, and marks only the subject line as a heading. Scoping prose as a string gives it a color chosen for string literals, which many themes deliberately keep close to comment, so the description is hard to separate from the `JJ:` boilerplate. String colors are also tuned to sit against code rather than to carry a paragraph, so the body can land below a readable contrast against the background. One real-world example are the 22 stock Omarchy themes, which generate their Helix theme from one shared template, the body as `@string` fails WCAG AA against the background in four of them (catppuccin-latte, flexoki-light, miasma, retro-82), and on retro-82 it sits at 1.34:1 against the JJ: comments. Left to `ui.text` it passes in all 22, and retro-82 becomes 4.54:1 against the comments and 13.39:1 against the background. Of the 279 languages with highlight queries, `jjdescription` is the only one that captures a bare prose node as @string. The grammar has no subject node, so the subject line is matched as the first named child of the document. Signed-off-by: Luke Hsiao <luke@hsiao.dev>
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.
The query captures the entire message body as
@string.jjdescriptionwas added by copying git-commit's language rules, but the two queries disagree about the part you actually type: git-commit leaves the body uncaptured so it renders asui.text, and marks only the subject line as a heading.Scoping prose as a string gives it a color chosen for string literals, which many themes deliberately keep close to comment, so the description is hard to separate from the
JJ:boilerplate. String colors are also tuned to sit against code rather than to carry a paragraph, so the body can land below a readable contrast against the background.One real-world example are the 22 stock Omarchy themes, which generate their Helix theme from one shared template, the body as
@stringfails WCAG AA against the background in four of them (catppuccin-latte, flexoki-light, miasma, retro-82), and on retro-82 it sits at 1.34:1 against the JJ: comments. Left toui.textit passes in all 22, and retro-82 becomes 4.54:1 against the comments and 13.39:1 against the background. Of the 279 languages with highlight queries,jjdescriptionis the only one that captures a bare prose node as @string.The grammar has no subject node, so the subject line is matched as the first named child of the document.
Example before/after
Default theme
Retro 82 in Omarchy