Skip to content

Fix SCSS single-line comments in selector state - #3336

Open
SAY-5 wants to merge 1 commit into
pygments:masterfrom
SAY-5:fix-scss-selector-line-comments
Open

SAY-5 wants to merge 1 commit into
pygments:masterfrom
SAY-5:fix-scss-selector-line-comments

Conversation

@SAY-5

@SAY-5 SAY-5 commented Oct 1, 2026

Copy link
Copy Markdown

SCSS declaration content can remain in the selector state after a property value. That state did not recognize // comments, so comments following declarations were highlighted as operators and selector names.

Add the comment rule to the SCSS selector state and protect URL contents before it runs. Quoted, unquoted, escaped and interpolated URLs keep their slashes as string content, including leading newlines and declarations without a space after :. Shared Sass, CSS and LESS rules remain unchanged.

Refs #2852. The LESS portion was addressed by #3005; this change covers the remaining SCSS selector/declaration path. It does not claim to fix the indented Sass portion. #3265 addresses percentages and placeholder selectors in the shared rules and covers a separate defect.

Validation on CPython 3.13.0:

  • 36 focused semantic cases pass, with retained failures on the unchanged code and intermediate URL guards.
  • Full suite: 5,367 passed, 16 skipped. Skips cover three existing guess cases, four SRCINFO filename cases, eight optional PIL formatter cases and the absent LaTeX executable.
  • All five configured source checks pass, including Ruff 0.15.2. These were direct executions of the configured commands; a complete tox environment/platform matrix was not run.
  • The new SCSS golden was generated with the repository's --update-goldens path, reviewed and then checked normally. The real CLI, 15 bounded malformed-input controls and unchanged neighboring lexer token streams were also checked. External nsgmls/LaTeX validation, docs, regexlint and a coverage report were not available or run.

OpenAI Codex assisted the investigation, implementation, tests and description. A separate Codex agent reviewed the final source and retained verification evidence.

Protect URL contents while recognizing comments after declarations.
Add semantic regressions and a regenerated SCSS golden.

Refs pygments#2852

Assisted-By: OpenAI Codex
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