Skip to content

Preserve functional pseudo-selector arguments in hover previews - #555

Merged
1 commit merged into
microsoft:mainfrom
pradeep-ramola:fix/169-functional-pseudo-hover
Nov 23, 2026
Merged

1 commit merged into
microsoft:mainfrom
pradeep-ramola:fix/169-functional-pseudo-hover

Conversation

@pradeep-ramola

Copy link
Copy Markdown
Contributor

Fixes #169.

The selector preview passes the entire pseudo-selector through scanUnquotedString, which stops at the opening parenthesis. As a result, :not(.class) is displayed as :not, losing the constraint it represents.

Unescape only the identifier portion, using its AST boundary, and preserve the remaining argument text verbatim. This also preserves nested functions, selector lists, whitespace, and escaped argument text. Specificity calculation is unchanged.

Tests:

  • Added direct selector-printing coverage, including escaped names and arguments.
  • Added doHover API coverage for CSS, SCSS, and Less.
  • Updated existing preview expectations to retain function arguments while keeping specificity expectations unchanged.
  • Confirmed the new regression failed on the original implementation.

Validation:

  • npm run compile (includes all 7 lint checks)
  • All 361 Node tests pass.

On Windows, the package node-test script discovers zero tests because of its quoted glob. I explicitly enumerated all compiled test files and passed them to node --test. The full run used a space-free worktree because existing URI fixtures fail when the checkout path contains spaces. No build configuration or dependency changes are included.

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.

:not() CSS3 selector is misparsed

2 participants