diff --git a/CSS/CSS.sublime-syntax b/CSS/CSS.sublime-syntax index c2b04edaff..247c43bb91 100644 --- a/CSS/CSS.sublime-syntax +++ b/CSS/CSS.sublime-syntax @@ -93,6 +93,18 @@ variables: 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}) @@ -1364,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