diff --git a/packages/tailwindcss-language-syntax/syntaxes/css.json b/packages/tailwindcss-language-syntax/syntaxes/css.json index 79ef22eb..398d42d5 100644 --- a/packages/tailwindcss-language-syntax/syntaxes/css.json +++ b/packages/tailwindcss-language-syntax/syntaxes/css.json @@ -31,6 +31,9 @@ }, { "include": "#rule-list" + }, + { + "include": "#nesting-selector" } ], "repository": { @@ -224,6 +227,9 @@ }, "name": "meta.at-rule.media.body.css", "patterns": [ + { + "include": "#nesting-at-rules" + }, { "include": "$self" } @@ -506,6 +512,9 @@ }, "name": "meta.at-rule.supports.body.css", "patterns": [ + { + "include": "#nesting-at-rules" + }, { "include": "$self" } @@ -1379,6 +1388,37 @@ }, "match": "(?xi)\n(?<=^|\\s|,|\\*/)\n(?:\n # Valid media types\n (all|print|screen|speech)\n |\n # Deprecated in Media Queries 4: http://dev.w3.org/csswg/mediaqueries/#media-types\n (aural|braille|embossed|handheld|projection|tty|tv)\n)\n(?=$|[{,\\s;]|/\\*)" }, + "nesting-at-rules": { + "patterns": [ + { + "include": "#commas" + }, + { + "include": "#nesting-rules" + }, + { + "include": "#rule-list-innards" + } + ] + }, + "nesting-rules": { + "patterns": [ + { + "match": "(?xi) (?\\s,.\\#|&){:\\[]|/\\*|$)", + "name": "entity.name.tag.css" + }, + { + "include": "#property-names" + }, + { + "include": "#selector-innards" + } + ] + }, + "nesting-selector": { + "match": "&", + "name": "entity.name.tag.nesting.selector.css" + }, "numeric-values": { "patterns": [ { @@ -1510,8 +1550,14 @@ }, "name": "meta.property-list.css", "patterns": [ + { + "include": "#nesting-rules" + }, { "include": "#rule-list-innards" + }, + { + "include": "$self" } ] }, @@ -1581,6 +1627,9 @@ }, "selector-innards": { "patterns": [ + { + "include": "#nesting-selector" + }, { "include": "#comment-block" }, @@ -1624,7 +1673,7 @@ ] } }, - "match": "(?x) (?+~|] # - Followed by another selector\n | /\\* # - Followed by a block comment\n )\n |\n # Name contains unescaped ASCII symbol\n (?: # Check for acceptable preceding characters\n [-a-zA-Z_0-9]|[^\\x00-\\x7F] # - Valid selector character\n | \\\\(?:[0-9a-fA-F]{1,6}|.) # - Escape sequence\n )*\n (?: # Invalid punctuation\n [!\"'%&(*;+~|&] # - Followed by another selector\n | /\\* # - Followed by a block comment\n )\n |\n # Name contains unescaped ASCII symbol\n (?: # Check for acceptable preceding characters\n [-a-zA-Z_0-9]|[^\\x00-\\x7F] # - Valid selector character\n | \\\\(?:[0-9a-fA-F]{1,6}|.) # - Escape sequence\n )*\n (?: # Invalid punctuation\n [!\"'%(*;+~|] # - Another selector\n | /\\* # - A block comment\n)", + "match": "(?x)\n(\\.) # Valid class-name\n(\n (?: [-a-zA-Z_0-9]|[^\\x00-\\x7F] # Valid identifier characters\n | \\\\(?:[0-9a-fA-F]{1,6}|.) # Escape sequence\n )+\n) # Followed by either:\n(?= $ # - End of the line\n | [\\s,.\\#)\\[:{>+~|&] # - Another selector\n | /\\* # - A block comment\n)", "name": "entity.other.attribute-name.class.css" }, { @@ -1656,7 +1705,7 @@ ] } }, - "match": "(?x)\n(\\#)\n(\n -?\n (?![0-9])\n (?:[-a-zA-Z0-9_]|[^\\x00-\\x7F]|\\\\(?:[0-9a-fA-F]{1,6}|.))+\n)\n(?=$|[\\s,.\\#)\\[:{>+~|]|/\\*)", + "match": "(?x)\n(\\#)\n(\n -?\n (?![0-9])\n (?:[-a-zA-Z0-9_]|[^\\x00-\\x7F]|\\\\(?:[0-9a-fA-F]{1,6}|.))+\n)\n(?=$|[\\s,.\\#)\\[:{>+~|&]|/\\*)", "name": "entity.other.attribute-name.id.css" }, { @@ -1820,7 +1869,7 @@ ] }, "tag-names": { - "match": "(?xi) (?\\s,.\\#|){:\\[]|/\\*|$)", + "match": "(?xi) (?\\s,.\\#|&){:\\[]|/\\*|$)", "name": "entity.name.tag.css" }, "unicode-range": { diff --git a/packages/tailwindcss-language-syntax/tests/__snapshots__/syntax.test.ts.snap b/packages/tailwindcss-language-syntax/tests/__snapshots__/syntax.test.ts.snap index 073bc3a8..3a56365f 100644 --- a/packages/tailwindcss-language-syntax/tests/__snapshots__/syntax.test.ts.snap +++ b/packages/tailwindcss-language-syntax/tests/__snapshots__/syntax.test.ts.snap @@ -31,6 +31,7 @@ exports[`@custom-variant 1`] = ` ^^^^ 1: variable.parameter.variant.tailwind ^^^^^^^^^^^^^^^^^^^^^^ 15: meta.selector.tailwind ^ 1: punctuation.section.variant.begin.bracket.paren.tailwind + ^ 1: entity.name.tag.nesting.selector.css ^^^ 2: entity.other.attribute-name.pseudo-class.css ^ ^ ^ 3: punctuation.definition.entity.css ^ 1: punctuation.section.function.begin.bracket.round.css @@ -48,7 +49,8 @@ exports[`@custom-variant 1`] = ` ^ 1: meta.at-rule.variant.body.tailwind punctuation.section.variant.begin.bracket.curly.tailwind &:is(.dark, .dark *) { -^^^^^^^^^^^^^^^^^^^^^^^^ 15: source.css.tailwind meta.at-rule.variant.body.tailwind +^^^^^^^^^^^^^^^^^^^^^^^^ 16: source.css.tailwind meta.at-rule.variant.body.tailwind + ^ 1: entity.name.tag.nesting.selector.css ^^^^^^^^^^^^^^^^^^^ 12: meta.selector.css ^^^ 2: entity.other.attribute-name.pseudo-class.css ^ ^ ^ 3: punctuation.definition.entity.css @@ -60,8 +62,10 @@ exports[`@custom-variant 1`] = ` ^ 1: meta.property-list.css punctuation.section.property-list.begin.bracket.curly.css @slot; -^^^^^^^^^^ 3: source.css.tailwind meta.at-rule.variant.body.tailwind meta.property-list.css - ^^^^ 1: meta.property-name.css +^^^^^^^^^^ 4: source.css.tailwind meta.at-rule.variant.body.tailwind meta.property-list.css + ^^^^^^ 3: meta.at-rule.header.css + ^^^^^ 2: keyword.control.at-rule.css + ^ 1: punctuation.definition.keyword.css ^ 1: punctuation.terminator.rule.css } @@ -83,21 +87,25 @@ exports[`@custom-variant 1`] = ` ^^^^^^^^^^^ 1: meta.selector.css &::before, -^^^^^^^^^^^^ 4: source.css.tailwind meta.at-rule.variant.body.tailwind meta.selector.css +^^^^^^^^^^^^ 5: source.css.tailwind meta.at-rule.variant.body.tailwind meta.selector.css + ^ 1: entity.name.tag.nesting.selector.css ^^^^^^^^ 2: entity.other.attribute-name.pseudo-element.css ^^ 1: punctuation.definition.entity.css ^ 1: punctuation.separator.list.comma.css &::after { -^^^^^^^^^^^^ 5: source.css.tailwind meta.at-rule.variant.body.tailwind -^^^^^^^^^^ 3: meta.selector.css +^^^^^^^^^^^^ 6: source.css.tailwind meta.at-rule.variant.body.tailwind +^^^^^^^^^^ 4: meta.selector.css + ^ 1: entity.name.tag.nesting.selector.css ^^^^^^^ 2: entity.other.attribute-name.pseudo-element.css ^^ 1: punctuation.definition.entity.css ^ 1: meta.property-list.css punctuation.section.property-list.begin.bracket.curly.css @slot; -^^^^^^^^^^ 3: source.css.tailwind meta.at-rule.variant.body.tailwind meta.property-list.css - ^^^^ 1: meta.property-name.css +^^^^^^^^^^ 4: source.css.tailwind meta.at-rule.variant.body.tailwind meta.property-list.css + ^^^^^^ 3: meta.at-rule.header.css + ^^^^^ 2: keyword.control.at-rule.css + ^ 1: punctuation.definition.keyword.css ^ 1: punctuation.terminator.rule.css } @@ -447,7 +455,7 @@ exports[`@layer 1`] = ` width: 12px; ^^^^^^^^^^^^^^^^ 7: source.css.tailwind meta.at-rule.layer.body.tailwind meta.property-list.css - ^^^^^ 1: meta.property-name.css support.type.property-name.css + ^^^^^ 1: support.type.property-name.css ^ 1: punctuation.separator.key-value.css ^^^^ 2: meta.property-value.css constant.numeric.css ^^ 1: keyword.other.unit.px.css @@ -506,7 +514,7 @@ exports[`@plugin with options 1`] = ` color: red; ^^^^^^^^^^^^^ 6: source.css.tailwind meta.property-list.css - ^^^^^ 1: meta.property-name.css support.type.property-name.css + ^^^^^ 1: support.type.property-name.css ^ 1: punctuation.separator.key-value.css ^^^ 1: meta.property-value.css support.constant.color.w3c-standard-color-name.css ^ 1: punctuation.terminator.rule.css @@ -529,7 +537,7 @@ body { color: red; ^^^^^^^^^^^^^ 6: source.css.tailwind meta.property-list.css - ^^^^^ 1: meta.property-name.css support.type.property-name.css + ^^^^^ 1: support.type.property-name.css ^ 1: punctuation.separator.key-value.css ^^^ 1: meta.property-value.css support.constant.color.w3c-standard-color-name.css ^ 1: punctuation.terminator.rule.css @@ -733,7 +741,7 @@ exports[`@theme 1`] = ` --color: red; ^^^^^^^^^^^^^^^ 6: source.css.tailwind meta.at-rule.theme.body.tailwind - ^^^^^^^ 1: meta.property-name.css + ^^^^^^^ 1: variable.css ^ 1: punctuation.separator.key-value.css ^^^ 1: meta.property-value.css support.constant.color.w3c-standard-color-name.css ^ 1: punctuation.terminator.rule.css @@ -750,7 +758,7 @@ exports[`@theme 1`] = ` --color: red; ^^^^^^^^^^^^^^^ 6: source.css.tailwind meta.at-rule.theme.body.tailwind - ^^^^^^^ 1: meta.property-name.css + ^^^^^^^ 1: variable.css ^ 1: punctuation.separator.key-value.css ^^^ 1: meta.property-value.css support.constant.color.w3c-standard-color-name.css ^ 1: punctuation.terminator.rule.css @@ -767,7 +775,7 @@ exports[`@theme 1`] = ` --color: red; ^^^^^^^^^^^^^^^ 6: source.css.tailwind meta.at-rule.theme.body.tailwind - ^^^^^^^ 1: meta.property-name.css + ^^^^^^^ 1: variable.css ^ 1: punctuation.separator.key-value.css ^^^ 1: meta.property-value.css support.constant.color.w3c-standard-color-name.css ^ 1: punctuation.terminator.rule.css @@ -788,7 +796,7 @@ exports[`@theme 1`] = ` --color: red; ^^^^^^^^^^^^^^^ 6: source.css.tailwind meta.at-rule.theme.body.tailwind - ^^^^^^^ 1: meta.property-name.css + ^^^^^^^ 1: variable.css ^ 1: punctuation.separator.key-value.css ^^^ 1: meta.property-value.css support.constant.color.w3c-standard-color-name.css ^ 1: punctuation.terminator.rule.css @@ -807,21 +815,22 @@ exports[`@theme 1`] = ` --spacing: initial; ^^^^^^^^^^^^^^^^^^^^^ 6: source.css.tailwind meta.at-rule.theme.body.tailwind - ^^^^^^^^^ 1: meta.property-name.css + ^^^^^^^^^ 1: variable.css ^ 1: punctuation.separator.key-value.css ^^^^^^^ 1: meta.property-value.css support.constant.property-value.css ^ 1: punctuation.terminator.rule.css --color-*: initial; ^^^^^^^^^^^^^^^^^^^^^ 7: source.css.tailwind meta.at-rule.theme.body.tailwind - ^^^^^^^^ 1: meta.property-name.css + ^^^^^^^^ 1: variable.css + ^ 1: entity.name.tag.wildcard.css ^ 1: punctuation.separator.key-value.css ^^^^^^^ 1: meta.property-value.css support.constant.property-value.css ^ 1: punctuation.terminator.rule.css --animate-pulse: 1s pulse infinite; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 9: source.css.tailwind meta.at-rule.theme.body.tailwind - ^^^^^^^^^^^^^^^ 1: meta.property-name.css + ^^^^^^^^^^^^^^^ 1: variable.css ^ 1: punctuation.separator.key-value.css ^^^^^^^^^^^^^^^^^ 4: meta.property-value.css ^^ 2: constant.numeric.css @@ -837,14 +846,15 @@ exports[`@theme 1`] = ` ^^^^^^^^^ ^^^^^ 2: meta.property-name.css 0%, -^^^^^^^^ 1: source.css.tailwind meta.at-rule.theme.body.tailwind +^^^^^^^ 2: source.css.tailwind meta.at-rule.theme.body.tailwind + ^ 1: punctuation.separator.list.comma.css 100% { ^^^^^^^^^^^ 1: source.css.tailwind meta.at-rule.theme.body.tailwind opacity: 0; ^^^^^^^^^^^^^^^^^ 6: source.css.tailwind meta.at-rule.theme.body.tailwind - ^^^^^^^ 1: meta.property-name.css support.type.property-name.css + ^^^^^^^ 1: support.type.property-name.css ^ 1: punctuation.separator.key-value.css ^ 1: meta.property-value.css constant.numeric.css ^ 1: punctuation.terminator.rule.css @@ -859,7 +869,7 @@ exports[`@theme 1`] = ` opacity: 1; ^^^^^^^^^^^^^^^^^ 6: source.css.tailwind meta.property-list.css - ^^^^^^^ 1: meta.property-name.css support.type.property-name.css + ^^^^^^^ 1: support.type.property-name.css ^ 1: punctuation.separator.key-value.css ^ 1: meta.property-value.css constant.numeric.css ^ 1: punctuation.terminator.rule.css @@ -943,7 +953,7 @@ exports[`@variant 1`] = ` color: white; ^^^^^^^^^^^^^^^^^ 6: source.css.tailwind meta.at-rule.variant.body.tailwind meta.property-list.css - ^^^^^ 1: meta.property-name.css support.type.property-name.css + ^^^^^ 1: support.type.property-name.css ^ 1: punctuation.separator.key-value.css ^^^^^ 1: meta.property-value.css support.constant.color.w3c-standard-color-name.css ^ 1: punctuation.terminator.rule.css @@ -1181,7 +1191,7 @@ exports[`legacy: @responsive 1`] = ` color: red; ^^^^^^^^^^^^^^^ 6: source.css.tailwind meta.at-rule.responsive.body.tailwind meta.property-list.css - ^^^^^ 1: meta.property-name.css support.type.property-name.css + ^^^^^ 1: support.type.property-name.css ^ 1: punctuation.separator.key-value.css ^^^ 1: meta.property-value.css support.constant.color.w3c-standard-color-name.css ^ 1: punctuation.terminator.rule.css @@ -1212,7 +1222,7 @@ exports[`legacy: @screen 1`] = ` color: red; ^^^^^^^^^^^^^^^ 6: source.css.tailwind meta.at-rule.screen.body.tailwind meta.property-list.css - ^^^^^ 1: meta.property-name.css support.type.property-name.css + ^^^^^ 1: support.type.property-name.css ^ 1: punctuation.separator.key-value.css ^^^ 1: meta.property-value.css support.constant.color.w3c-standard-color-name.css ^ 1: punctuation.terminator.rule.css @@ -1244,7 +1254,7 @@ exports[`legacy: @variants 1`] = ` color: red; ^^^^^^^^^^^^^^^ 6: source.css.tailwind meta.at-rule.variants.body.tailwind meta.property-list.css - ^^^^^ 1: meta.property-name.css support.type.property-name.css + ^^^^^ 1: support.type.property-name.css ^ 1: punctuation.separator.key-value.css ^^^ 1: meta.property-value.css support.constant.color.w3c-standard-color-name.css ^ 1: punctuation.terminator.rule.css diff --git a/packages/vscode-tailwindcss/syntaxes/at-rules.tmLanguage.json b/packages/vscode-tailwindcss/syntaxes/at-rules.tmLanguage.json index 0e074444..601ca307 100644 --- a/packages/vscode-tailwindcss/syntaxes/at-rules.tmLanguage.json +++ b/packages/vscode-tailwindcss/syntaxes/at-rules.tmLanguage.json @@ -1,7 +1,10 @@ { "scopeName": "tailwindcss.at-rules.injection", "fileTypes": [], - "injectionSelector": "L:source.css -comment -source.css.scss", + "injectionSelector": [ + "L:source.css -comment -source.css.scss", + "L:source.css.tailwind -comment -source.css.scss" + ], "name": "TailwindCSS", "patterns": [ { @@ -210,7 +213,7 @@ "name": "meta.at-rule.theme.body.tailwind", "patterns": [ { - "include": "#property-list" + "include": "source.css.tailwind#nesting-at-rules" } ] } diff --git a/packages/vscode-tailwindcss/syntaxes/source.css.tailwind.tmLanguage.json b/packages/vscode-tailwindcss/syntaxes/source.css.tailwind.tmLanguage.json index 9982b6e1..73a42559 100644 --- a/packages/vscode-tailwindcss/syntaxes/source.css.tailwind.tmLanguage.json +++ b/packages/vscode-tailwindcss/syntaxes/source.css.tailwind.tmLanguage.json @@ -1,9 +1,1917 @@ { + "__tailwind_notes__": [ + "This was copied from VSCode and is used for testing purposes", + "https://github.com/microsoft/vscode/blob/2e59a779912bc1b7b2505ae52aff3a7648c24857/extensions/css/syntaxes/css.tmLanguage.json", + "It is covered by the MIT license:", + "https://github.com/microsoft/vscode/blob/2e59a779912bc1b7b2505ae52aff3a7648c24857/LICENSE.txt" + ], + "information_for_contributors": [ + "This file has been converted from https://github.com/microsoft/vscode-css/blob/master/grammars/css.cson", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/microsoft/vscode-css/commit/a927fe2f73927bf5c25d0b0c4dd0e63d69fd8887", "name": "TailwindCSS", "scopeName": "source.css.tailwind", "patterns": [ { - "include": "source.css" + "include": "#comment-block" + }, + { + "include": "#escapes" + }, + { + "include": "#combinators" + }, + { + "include": "#selector" + }, + { + "include": "#at-rules" + }, + { + "include": "#rule-list" + }, + { + "include": "#nesting-selector" + } + ], + "repository": { + "at-rules": { + "patterns": [ + { + "begin": "\\A(?:\\xEF\\xBB\\xBF)?(?i:(?=\\s*@charset\\b))", + "end": ";|(?=$)", + "endCaptures": { + "0": { + "name": "punctuation.terminator.rule.css" + } + }, + "name": "meta.at-rule.charset.css", + "patterns": [ + { + "captures": { + "1": { + "name": "invalid.illegal.not-lowercase.charset.css" + }, + "2": { + "name": "invalid.illegal.leading-whitespace.charset.css" + }, + "3": { + "name": "invalid.illegal.no-whitespace.charset.css" + }, + "4": { + "name": "invalid.illegal.whitespace.charset.css" + }, + "5": { + "name": "invalid.illegal.not-double-quoted.charset.css" + }, + "6": { + "name": "invalid.illegal.unclosed-string.charset.css" + }, + "7": { + "name": "invalid.illegal.unexpected-characters.charset.css" + } + }, + "match": "(?x) # Possible errors:\n\\G\n((?!@charset)@\\w+) # Not lowercase (@charset is case-sensitive)\n|\n\\G(\\s+) # Preceding whitespace\n|\n(@charset\\S[^;]*) # No whitespace after @charset\n|\n(?<=@charset) # Before quoted charset name\n(\\x20{2,}|\\t+) # More than one space used, or a tab\n|\n(?<=@charset\\x20) # Beginning of charset name\n([^\";]+) # Not double-quoted\n|\n(\"[^\"]+$) # Unclosed quote\n|\n(?<=\") # After charset name\n([^;]+) # Unexpected junk instead of semicolon" + }, + { + "captures": { + "1": { + "name": "keyword.control.at-rule.charset.css" + }, + "2": { + "name": "punctuation.definition.keyword.css" + } + }, + "match": "((@)charset)(?=\\s)" + }, + { + "begin": "\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.css" + } + }, + "end": "\"|$", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.css" + } + }, + "name": "string.quoted.double.css", + "patterns": [ + { + "begin": "(?:\\G|^)(?=(?:[^\"])+$)", + "end": "$", + "name": "invalid.illegal.unclosed.string.css" + } + ] + } + ] + }, + { + "begin": "(?i)((@)import)(?:\\s+|$|(?=['\"]|/\\*))", + "beginCaptures": { + "1": { + "name": "keyword.control.at-rule.import.css" + }, + "2": { + "name": "punctuation.definition.keyword.css" + } + }, + "end": ";", + "endCaptures": { + "0": { + "name": "punctuation.terminator.rule.css" + } + }, + "name": "meta.at-rule.import.css", + "patterns": [ + { + "begin": "\\G\\s*(?=/\\*)", + "end": "(?<=\\*/)\\s*", + "patterns": [ + { + "include": "#comment-block" + } + ] + }, + { + "include": "#string" + }, + { + "include": "#url" + }, + { + "include": "#media-query-list" + } + ] + }, + { + "begin": "(?i)((@)font-face)(?=\\s*|{|/\\*|$)", + "beginCaptures": { + "1": { + "name": "keyword.control.at-rule.font-face.css" + }, + "2": { + "name": "punctuation.definition.keyword.css" + } + }, + "end": "(?!\\G)", + "name": "meta.at-rule.font-face.css", + "patterns": [ + { + "include": "#comment-block" + }, + { + "include": "#escapes" + }, + { + "include": "#rule-list" + } + ] + }, + { + "begin": "(?i)(@)page(?=[\\s:{]|/\\*|$)", + "captures": { + "0": { + "name": "keyword.control.at-rule.page.css" + }, + "1": { + "name": "punctuation.definition.keyword.css" + } + }, + "end": "(?=\\s*($|[:{;]))", + "name": "meta.at-rule.page.css", + "patterns": [ + { + "include": "#rule-list" + } + ] + }, + { + "begin": "(?i)(?=@media(\\s|\\(|/\\*|$))", + "end": "(?<=})(?!\\G)", + "patterns": [ + { + "begin": "(?i)\\G(@)media", + "beginCaptures": { + "0": { + "name": "keyword.control.at-rule.media.css" + }, + "1": { + "name": "punctuation.definition.keyword.css" + } + }, + "end": "(?=\\s*[{;])", + "name": "meta.at-rule.media.header.css", + "patterns": [ + { + "include": "#media-query-list" + } + ] + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.media.begin.bracket.curly.css" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.section.media.end.bracket.curly.css" + } + }, + "name": "meta.at-rule.media.body.css", + "patterns": [ + { + "include": "#nesting-at-rules" + }, + { + "include": "$self" + } + ] + } + ] + }, + { + "begin": "(?i)(?=@counter-style([\\s'\"{;]|/\\*|$))", + "end": "(?<=})(?!\\G)", + "patterns": [ + { + "begin": "(?i)\\G(@)counter-style", + "beginCaptures": { + "0": { + "name": "keyword.control.at-rule.counter-style.css" + }, + "1": { + "name": "punctuation.definition.keyword.css" + } + }, + "end": "(?=\\s*{)", + "name": "meta.at-rule.counter-style.header.css", + "patterns": [ + { + "include": "#comment-block" + }, + { + "include": "#escapes" + }, + { + "captures": { + "0": { + "patterns": [ + { + "include": "#escapes" + } + ] + } + }, + "match": "(?x)\n(?:[-a-zA-Z_] | [^\\x00-\\x7F]) # First letter\n(?:[-a-zA-Z0-9_] | [^\\x00-\\x7F] # Remainder of identifier\n |\\\\(?:[0-9a-fA-F]{1,6}|.)\n)*", + "name": "variable.parameter.style-name.css" + } + ] + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.property-list.begin.bracket.curly.css" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.section.property-list.end.bracket.curly.css" + } + }, + "name": "meta.at-rule.counter-style.body.css", + "patterns": [ + { + "include": "#comment-block" + }, + { + "include": "#escapes" + }, + { + "include": "#rule-list-innards" + } + ] + } + ] + }, + { + "begin": "(?i)(?=@document([\\s'\"{;]|/\\*|$))", + "end": "(?<=})(?!\\G)", + "patterns": [ + { + "begin": "(?i)\\G(@)document", + "beginCaptures": { + "0": { + "name": "keyword.control.at-rule.document.css" + }, + "1": { + "name": "punctuation.definition.keyword.css" + } + }, + "end": "(?=\\s*[{;])", + "name": "meta.at-rule.document.header.css", + "patterns": [ + { + "begin": "(?i)(?>>", + "name": "invalid.deprecated.combinator.css" + }, + { + "match": ">>|>|\\+|~", + "name": "keyword.operator.combinator.css" + } + ] + }, + "commas": { + "match": ",", + "name": "punctuation.separator.list.comma.css" + }, + "comment-block": { + "begin": "/\\*", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.begin.css" + } + }, + "end": "\\*/", + "endCaptures": { + "0": { + "name": "punctuation.definition.comment.end.css" + } + }, + "name": "comment.block.css" + }, + "escapes": { + "patterns": [ + { + "match": "\\\\[0-9a-fA-F]{1,6}", + "name": "constant.character.escape.codepoint.css" + }, + { + "begin": "\\\\$\\s*", + "end": "^(?<:=]|\\)|/\\*) # Terminates cleanly" + }, + "media-feature-keywords": { + "match": "(?xi)\n(?<=^|\\s|:|\\*/)\n(?: portrait # Orientation\n | landscape\n | progressive # Scan types\n | interlace\n | fullscreen # Display modes\n | standalone\n | minimal-ui\n | browser\n | hover\n)\n(?=\\s|\\)|$)", + "name": "support.constant.property-value.css" + }, + "media-query": { + "begin": "\\G", + "end": "(?=\\s*[{;])", + "patterns": [ + { + "include": "#comment-block" + }, + { + "include": "#escapes" + }, + { + "include": "#media-types" + }, + { + "match": "(?i)(?<=\\s|^|,|\\*/)(only|not)(?=\\s|{|/\\*|$)", + "name": "keyword.operator.logical.$1.media.css" + }, + { + "match": "(?i)(?<=\\s|^|\\*/|\\))and(?=\\s|/\\*|$)", + "name": "keyword.operator.logical.and.media.css" + }, + { + "match": ",(?:(?:\\s*,)+|(?=\\s*[;){]))", + "name": "invalid.illegal.comma.css" + }, + { + "include": "#commas" + }, + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.definition.parameters.begin.bracket.round.css" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.end.bracket.round.css" + } + }, + "patterns": [ + { + "include": "#media-features" + }, + { + "include": "#media-feature-keywords" + }, + { + "match": ":", + "name": "punctuation.separator.key-value.css" + }, + { + "match": ">=|<=|=|<|>", + "name": "keyword.operator.comparison.css" + }, + { + "captures": { + "1": { + "name": "constant.numeric.css" + }, + "2": { + "name": "keyword.operator.arithmetic.css" + }, + "3": { + "name": "constant.numeric.css" + } + }, + "match": "(\\d+)\\s*(/)\\s*(\\d+)", + "name": "meta.ratio.css" + }, + { + "include": "#numeric-values" + }, + { + "include": "#comment-block" + } + ] + } + ] + }, + "media-query-list": { + "begin": "(?=\\s*[^{;])", + "end": "(?=\\s*[{;])", + "patterns": [ + { + "include": "#media-query" + } + ] + }, + "media-types": { + "captures": { + "1": { + "name": "support.constant.media.css" + }, + "2": { + "name": "invalid.deprecated.constant.media.css" + } + }, + "match": "(?xi)\n(?<=^|\\s|,|\\*/)\n(?:\n # Valid media types\n (all|print|screen|speech)\n |\n # Deprecated in Media Queries 4: http://dev.w3.org/csswg/mediaqueries/#media-types\n (aural|braille|embossed|handheld|projection|tty|tv)\n)\n(?=$|[{,\\s;]|/\\*)" + }, + "nesting-at-rules": { + "patterns": [ + { + "include": "#commas" + }, + { + "include": "#nesting-rules" + }, + { + "include": "#rule-list-innards" + } + ] + }, + "nesting-rules": { + "patterns": [ + { + "match": "(?xi) (?\\s,.\\#|&){:\\[]|/\\*|$)", + "name": "entity.name.tag.css" + }, + { + "include": "#property-names" + }, + { + "include": "#selector" + } + ] + }, + "nesting-selector": { + "match": "&", + "name": "entity.name.tag.nesting.selector.css" + }, + "numeric-values": { + "patterns": [ + { + "captures": { + "1": { + "name": "punctuation.definition.constant.css" + } + }, + "match": "(#)(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\\b", + "name": "constant.other.color.rgb-value.hex.css" + }, + { + "captures": { + "1": { + "name": "keyword.other.unit.percentage.css" + }, + "2": { + "name": "keyword.other.unit.${2:/downcase}.css" + } + }, + "match": "(?xi) (?+~|&] # - Followed by another selector\n | /\\* # - Followed by a block comment\n )\n |\n # Name contains unescaped ASCII symbol\n (?: # Check for acceptable preceding characters\n [-a-zA-Z_0-9]|[^\\x00-\\x7F] # - Valid selector character\n | \\\\(?:[0-9a-fA-F]{1,6}|.) # - Escape sequence\n )*\n (?: # Invalid punctuation\n [!\"'%(*;+~|&] # - Another selector\n | /\\* # - A block comment\n)", + "name": "entity.other.attribute-name.class.css" + }, + { + "captures": { + "1": { + "name": "punctuation.definition.entity.css" + }, + "2": { + "patterns": [ + { + "include": "#escapes" + } + ] + } + }, + "match": "(?x)\n(\\#)\n(\n -?\n (?![0-9])\n (?:[-a-zA-Z0-9_]|[^\\x00-\\x7F]|\\\\(?:[0-9a-fA-F]{1,6}|.))+\n)\n(?=$|[\\s,.\\#)\\[:{>+~|&]|/\\*)", + "name": "entity.other.attribute-name.id.css" + }, + { + "begin": "\\[", + "beginCaptures": { + "0": { + "name": "punctuation.definition.entity.begin.bracket.square.css" + } + }, + "end": "\\]", + "endCaptures": { + "0": { + "name": "punctuation.definition.entity.end.bracket.square.css" + } + }, + "name": "meta.attribute-selector.css", + "patterns": [ + { + "include": "#comment-block" + }, + { + "include": "#string" + }, + { + "captures": { + "1": { + "name": "storage.modifier.ignore-case.css" + } + }, + "match": "(?<=[\"'\\s]|^|\\*/)\\s*([iI])\\s*(?=[\\s\\]]|/\\*|$)" + }, + { + "captures": { + "1": { + "name": "string.unquoted.attribute-value.css", + "patterns": [ + { + "include": "#escapes" + } + ] + } + }, + "match": "(?x)(?<==)\\s*((?!/\\*)(?:[^\\\\\"'\\s\\]]|\\\\.)+)" + }, + { + "include": "#escapes" + }, + { + "match": "[~|^$*]?=", + "name": "keyword.operator.pattern.css" + }, + { + "match": "\\|", + "name": "punctuation.separator.css" + }, + { + "captures": { + "1": { + "name": "entity.other.namespace-prefix.css", + "patterns": [ + { + "include": "#escapes" + } + ] + } + }, + "match": "(?x)\n# Qualified namespace prefix\n( -?(?!\\d)(?:[\\w-]|[^\\x00-\\x7F]|\\\\(?:[0-9a-fA-F]{1,6}|.))+\n| \\*\n)\n# Lookahead to ensure there's a valid identifier ahead\n(?=\n \\| (?!\\s|=|$|\\])\n (?: -?(?!\\d)\n | [\\\\\\w-]\n | [^\\x00-\\x7F]\n )\n)" + }, + { + "captures": { + "1": { + "name": "entity.other.attribute-name.css", + "patterns": [ + { + "include": "#escapes" + } + ] + } + }, + "match": "(?x)\n(-?(?!\\d)(?>[\\w-]|[^\\x00-\\x7F]|\\\\(?:[0-9a-fA-F]{1,6}|.))+)\n\\s*\n(?=[~|^\\]$*=]|/\\*)" + } + ] + }, + { + "include": "#pseudo-classes" + }, + { + "include": "#pseudo-elements" + }, + { + "include": "#functional-pseudo-classes" + }, + { + "match": "(?x) (?\\s,.\\#|&){:\\[]|/\\*|$)", + "name": "entity.name.tag.css" + }, + "unicode-range": { + "captures": { + "0": { + "name": "constant.other.unicode-range.css" + }, + "1": { + "name": "punctuation.separator.dash.unicode-range.css" + } + }, + "match": "(?