Skip to content

Fix CSS Nesting selector validation - #47

Merged
Alex Ross (alexr00) merged 35 commits into
microsoft:mainfrom
torresgol10:fix/css-nesting
Jul 24, 2026
Merged

Fix CSS Nesting selector validation#47
Alex Ross (alexr00) merged 35 commits into
microsoft:mainfrom
torresgol10:fix/css-nesting

Conversation

@torresgol10

@torresgol10 Ivan Torres (torresgol10) commented Nov 21, 2025

Copy link
Copy Markdown
Contributor

Supersedes #30. Continues the work of Jacob Cassidy (@jacobcassidy) to add CSS Nesting support.

This should fix #9 and #15.

Changes:

Updated css.cson to allow & followed by identifier characters.
Added tests in css-spec.mjs covering nesting scenarios.

@thernstig

Copy link
Copy Markdown

Just a note that I think this will close many other issues:

I did not verify this or do a deep dive, but some comments indicate this. Might be worth to check various issues once this is merged.

@torresgol10

Ivan Torres (torresgol10) commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

Tobias Hernstig (@thernstig) Good catch! I verified all three issues:

Here's how it looks with this PR applied:

image

If anything doesn't look right, let me know and I can adjust.

A note on the red underlines (validation errors): Some newer CSS syntax like if() may still show validation warnings/errors (red underlines). This is not caused by this PR or this grammar — it comes from the vscode-css-languageservice, which is a separate repository. VS Code currently bundles an older version of that service that doesn't recognize some newer CSS features yet. The newer version of vscode-css-languageservice already has updates that address some of these, but they haven't been shipped in VS Code yet.

@thernstig

Tobias Hernstig (thernstig) commented Apr 1, 2026

Copy link
Copy Markdown

I went through all open issues and found these that this PR might fix:

@thernstig

Copy link
Copy Markdown

Ivan Torres (@torresgol10) did you get a chance to look at the last issues I linked?

@torresgol10

Copy link
Copy Markdown
Contributor Author

Hi Tobias Hernstig (@thernstig) , I did take a look at it, but I think it’s better to address those details in a new PR. This PR has been waiting to be merged for months, and if we add more features, it will take even longer. I think the priority is to get this feature merged. We should open new PRs for those issues. What do you think?

@thernstig

Copy link
Copy Markdown

Ivan Torres (@torresgol10) agree completely, hope some maintainer can look at this now as it's been open for so long.

@thernstig

Copy link
Copy Markdown

Ivan Torres (@torresgol10) Is the PR ready? How confident are you it does not break the existing highlighter?

Alex Ross (@alexr00) FYI

Martin Aeschlimann (@aeschli) if you look further up, it is ready. Alex Ross (@alexr00)

@thernstig

Copy link
Copy Markdown

Martin Aeschlimann (@aeschli) Alex Ross (@alexr00) please, please review. CSS nesting has been out for over 2 years in major browsers. Is there a chance you could give someone more active maintainer status here? Since this is the built-in CSS extension I think it deserves some continuous love and to not be neglected like this.

@thernstig

Copy link
Copy Markdown

Upvote #53 if you feel the same.

@romainmenke

Copy link
Copy Markdown
Contributor

Martin Aeschlimann (@aeschli) It would be really great if we could apply this change before others that might conflict with it, like #52 🙇

auto-merge was automatically disabled July 22, 2026 10:21

Pull request was closed

@alexr00

Copy link
Copy Markdown
Member

This found a bug in one of our PR checks. Fix coming soon.

@alexr00
Alex Ross (alexr00) merged commit 055373b into microsoft:main Jul 24, 2026
6 checks passed
@thernstig

Copy link
Copy Markdown

Ivan Torres (@torresgol10) did this fix #15? #15 is a PR. Should that one be closed?

Or did you mean it fixed #18 and #18 should be closed?

@jacobcassidy

Copy link
Copy Markdown
Contributor

Alex Ross (@alexr00) What needs to happen for the latest vscode-css repo changes (from this PR merge) to get pushed to the vscode repo so the changes will be included in the official vscode/extensions/css/syntaxes/css.tmLaguage.json file?

@alexr00

Copy link
Copy Markdown
Member

Pinging me is a good way to make that happen 😅. I used to run the update every release (read: every month), but now that we release every week it hasn't seemed worth running it every week. microsoft/vscode#330193

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.

Add support for nested CSS