Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CSS] Add :global() and :local() pseudo-classes #3944

Merged
merged 3 commits into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions CSS/CSS.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,21 @@ variables:

keyframe_selector_begin: (?=\b(?i:from|to){{break}}|\.?[\d,%])

pseudo_classes_with_selector_args: |-
(?xi: global | local | matches | is | where | not | has | host(?:-context)?)

pseudo_classes_with_anb_args: |-
(?xi:
# https://drafts.csswg.org/selectors-4/#table-pseudos
nth-last-col
| nth-col
# https://drafts.csswg.org/selectors-4/#typed-child-index
| nth-last-child
| nth-child
| nth-last-of-type
| nth-of-type
)

# Combinators
# https://drafts.csswg.org/selectors-4/#combinators
combinators: (?:>{1,3}|[~+]|\|{2})
Expand Down Expand Up @@ -1361,17 +1376,7 @@ contexts:
# Functional Pseudo Classes with `An+B` param
# An+B Notation: https://drafts.csswg.org/css-syntax/#anb
pseudo-class-function-with-anb-args:
- match: |-
(?xi:
# https://drafts.csswg.org/selectors-4/#table-pseudos
nth-last-col
| nth-col
# https://drafts.csswg.org/selectors-4/#typed-child-index
| nth-last-child
| nth-child
| nth-last-of-type
| nth-of-type
)(?=\()
- match: '{{pseudo_classes_with_anb_args}}(?=\()'
scope: meta.function-call.identifier.css entity.other.pseudo-class.css
set:
- pseudo-class-anb-arguments-list-body
Expand Down Expand Up @@ -1400,7 +1405,8 @@ contexts:

# Functional Pseudo Classes with selector list
pseudo-class-function-with-selector-args:
- match: (?i:matches|is|where|not|has|host(?:-context)?)(?=\()
# global(), local() - CSS Modules, Less, Astro
- match: '{{pseudo_classes_with_selector_args}}(?=\()'
scope: meta.function-call.identifier.css entity.other.pseudo-class.css
set:
- pseudo-class-selector-arguments-list-body
Expand Down
Loading