Skip to content

feat(scopes): diff/log/preprocessor/constants/labels/strikethrough/support coverage - #15

Merged
crypticpy merged 1 commit into
mainfrom
feat/scope-coverage
Aug 18, 2026
Merged

feat(scopes): diff/log/preprocessor/constants/labels/strikethrough/support coverage#15
crypticpy merged 1 commit into
mainfrom
feat/scope-coverage

Conversation

@crypticpy

@crypticpy crypticpy commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

Plan step 4 of docs/plans/2026-08-18-audit-remediation.md — fill the scope gaps the audit found. No new hexes: every new rule binds to an existing role token in base.yaml, so all variants inherit it and the parity check stays green.

TextMate rules added

  • Diff: markup.inserted/deleted/changed (+ .diff punctuation) → git-decoration added/deleted/modified colours; meta.diff.header* / meta.diff.index → doc-comment colour; meta.diff.range → keyword colour
  • Log files: token.info-token / warn-token / error-token (bold) / debug-token → debug-console colours
  • Preprocessor: keyword.control.directive (bold, keyword colour); entity.name.function.preprocessor|macro (bold, macro colour)
  • ALL_CAPS constants: variable.other.constant, constant.other.caps, variable.other.enummember
  • Labels: entity.name.label, entity.name.goto-label
  • Markdown strikethrough (deprecated colour + strikethrough)
  • support.variable / .property / .dom / .object.process*.defaultLibrary colour, italic

Semantic token types added

selfParameter, clsParameter (this/self colour, italic), magicFunction, builtinConstant, boolean, builtinType, lifetime, attribute, derive, formatSpecifier, escapeSequence (bold), event.

Also

  • samples/demo.diff, samples/demo.log for eyeballing (.gitignore un-ignores samples/demo.log)
  • CHANGELOG 2.0.0 "Added — Scope coverage"

Test plan

  • npm run check (build → verify all hard-fail checks → README tables) green
  • npm test 26/26 — the v1.2.0 snapshot coverage test (additions-only, name-keyed) passes with the new rules
  • Opened samples/demo.{diff,log,py,rs} in all three variants

🤖 Generated with Claude Code

Summary by Sourcery

Add comprehensive syntax and semantic scope coverage while preserving existing palette roles and variant parity.

New Features:

  • Expand theme scope coverage for diffs, logs, preprocessors, constants, labels, Markdown strikethrough, support variables, and additional semantic token types across all variants.

Enhancements:

  • Bind new scope and semantic-token styles to existing role tokens so variant inheritance and palette key parity are preserved.

Documentation:

  • Document the new scope coverage in the 2.0.0 changelog.

Tests:

  • Add diff and log sample files for visual theme verification.

…pport coverage

New tokenColors rules and semantic selectors in base.yaml, all bound to
existing role tokens (no new hexes, parity unchanged). Snapshot test now
checks additions-only structural coverage. samples/demo.{diff,log} added
(.gitignore negation for the .log sample).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sourcery-ai

sourcery-ai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds missing scope coverage for diffs, logs, preprocessors, ALL_CAPS constants, labels, markdown strikethrough, support variables, and several semantic token types, all wired to existing role tokens to avoid new palette entries, plus sample files and changelog documentation.

File-Level Changes

Change Details Files
Add semantic token coverage for various language constructs while reusing existing role token colors.
  • Introduce semantic selectors like selfParameter, clsParameter, magicFunction, builtinConstant/boolean, builtinType, lifetime, attribute/derive, formatSpecifier, escapeSequence, and event.
  • Map each new semantic selector to existing tokenColors or semanticTokenColors roles, often with italic or bold styles, ensuring no new hex values are introduced.
themes/_src/base.yaml
Add TextMate scope coverage for diffs, logs, preprocessors, constants, labels, markdown strikethrough, and support variables using existing colors.
  • Define diff-related scopes (inserted/deleted/changed, headers, ranges) and bind them to gitDecoration or existing documentation/keyword colors.
  • Add log token scopes (info, warn, error, debug) wired to debug console colors, with error in bold.
  • Style preprocessor directives and macros with keyword and macro colors, bolded for emphasis.
  • Give ALL_CAPS constants, labels, markdown strikethrough, and support variables explicit rules mapped to existing constants, label, deprecated, and defaultLibrary styles.
themes/_src/base.yaml
Document the new scope coverage and ensure it is reflected in the changelog and testing story.
  • Add a new "Added — Scope coverage" section describing all newly covered scopes and semantic selectors and clarifying they reuse existing role tokens.
  • Note that the snapshot-based pipeline test enforces that all previously styled keys remain unchanged while allowing additions.
CHANGELOG.md
Add sample files and adjust gitignore to support visual inspection of new scopes.
  • Introduce samples/demo.diff and samples/demo.log showcasing diff and log scopes for manual verification across theme variants.
  • Update .gitignore so demo.log is checked in rather than ignored.
samples/demo.diff
samples/demo.log
.gitignore
Regenerate compiled theme JSON variants to incorporate new scope and semantic token mappings.
  • Update each theme JSON (alone, alone-focused, alone-soft) so they include the new tokenColors and semanticTokenColors derived from base.yaml.
  • Ensure the compiled themes stay consistent with the base source and share the same role-token bindings.
themes/alone-color-theme.json
themes/alone-focused-color-theme.json
themes/alone-soft-color-theme.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In the Labels token color rule, foreground is set to ${semanticTokenColors.label}, which likely expands to an object rather than a hex/string; this should probably reference the actual color value (e.g. ${semanticTokenColors.label.foreground}) to match other token → semantic bindings.
  • For consistency with the rest of base.yaml, consider using the same style of indirection for event as for similar selectors (e.g. ${semanticTokenColors.property.foreground} instead of ${semanticTokenColors.property}) so that semantic token values are always resolved to concrete colors rather than whole objects.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the `Labels` token color rule, `foreground` is set to `${semanticTokenColors.label}`, which likely expands to an object rather than a hex/string; this should probably reference the actual color value (e.g. `${semanticTokenColors.label.foreground}`) to match other token → semantic bindings.
- For consistency with the rest of `base.yaml`, consider using the same style of indirection for `event` as for similar selectors (e.g. `${semanticTokenColors.property.foreground}` instead of `${semanticTokenColors.property}`) so that semantic token values are always resolved to concrete colors rather than whole objects.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@crypticpy

Copy link
Copy Markdown
Owner Author

Re Sourcery review: ${semanticTokenColors.label} and ${semanticTokenColors.property} are token names, not paths into the built JSON — in every variant file they're bound to a bare hex string (semanticTokenColors.label: '#E8B850'), and base.yaml line 67 / 21 uses the same tokens for the semantic entries themselves (label: ${semanticTokenColors.label}, a plain-string selector). The .foreground form exists only for selectors whose semantic entry is an object (property.defaultLibrary, type.defaultLibrary, …). The built output confirms: the Labels rule renders "foreground": "#E8B850" and the generator would have thrown on a non-string. Leaving as-is.

@crypticpy
crypticpy merged commit 126b258 into main Aug 18, 2026
3 checks passed
@crypticpy
crypticpy deleted the feat/scope-coverage branch August 18, 2026 07:14
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