Skip to content

Commit

Permalink
wip: better abstractions
Browse files Browse the repository at this point in the history
  • Loading branch information
schoero committed Sep 2, 2024
1 parent f5e94df commit 1d16ebe
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 166 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"source.tsx",
"text.html"
],
"path": "./syntaxes/tailwindcss.json",
"path": "./syntaxes/tailwindcss.tmLanguage.json",
"scopeName": "source.tailwindcss"
}
]
Expand Down
292 changes: 127 additions & 165 deletions syntaxes/tailwindcss.json → syntaxes/tailwindcss.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,91 @@
"name": "tailwindcss syntax highlighting",
"patterns": [
{
"include": "#class-attribute"
}
],
"repository": {
"braces": {
"captures": {
"1": {
"name": "entity.other.attribute-name.tailwindcss"
},
"2": {
"name": "keyword.operator.assignment.tailwindcss"
},
"3": {
"name": "punctuation.definition.block.tailwindcss"
}
},
"match": "([{}])"
},
"brackets": {
"captures": {
"1": {
"name": "meta.brace.square.tailwindcss"
},
"4": {
"name": "string.quoted.tailwindcss",
"patterns": [
{
"include": "#quotes"
}
]
},
"5": {
"name": "string.quoted.tailwindcss",
"2": {
"patterns": [
{
"captures": {
"1": {
"name": "support.type.property-name.css.tailwindcss",
"patterns": [
{
"include": "#class-with-variants"
"match": "(.*)",
"name": "property-name.tailwindcss"
}
]
},
"2": {
"name": "keyword.operator.assignment.tailwindcss"
},
"3": {
"patterns": [
{
"captures": {
"1": {
"name": "property-value.tailwindcss",
"patterns": [
{
"include": "#numbers"
},
{
"include": "#functions"
},
{
"include": "#selectors"
},
{
"include": "#commas"
}
]
}
},
"match": "(.*)",
"name": "support.constant.property-value.css.tailwindcss"
}
]
}
},
"match": "([^\\s]+)"
}
]
},
"6": {
"name": "string.quoted.tailwindcss",
"patterns": [
"match": "([\\w-]+)(:)(.*)"
},
{
"include": "#quotes"
"include": "#numbers"
},
{
"include": "#functions"
},
{
"include": "#selectors"
},
{
"include": "#commas"
}
]
},
"7": {
"name": "punctuation.definition.block.tailwindcss"
"3": {
"name": "meta.brace.square.tailwindcss"
}
},
"match": "\\s*\\b(class|className)\\b\\s*(=)\\s*({?)\\s*([\"'`])\\s*(.*?)\\s*(\\4)(?:\\s*(?=\\s*}))?(}?)"
"match": "(\\[)(.*)(\\])"
},
{
"begin": "\\s*\\b(class|className)\\b\\s*(=)\\s*({?)\\s*([\"'`])",
"class-attribute": {
"begin": "\\s*\\b(class|className)\\b\\s*(=)\\s*({)?([\"'`])",
"beginCaptures": {
"1": {
"name": "entity.other.attribute-name.tailwindcss"
Expand All @@ -63,163 +97,40 @@
"name": "keyword.operator.assignment.tailwindcss"
},
"3": {
"name": "punctuation.definition.block.tailwindcss"
"patterns": [
{
"include": "#braces"
}
]
},
"4": {
"name": "string.quoted.tailwindcss",
"patterns": [
{
"include": "#quotes"
}
]
}
},
"end": "\\s*(\\4)\\s*(}?)\\s*",
"end": "([\\4])(})?",
"endCaptures": {
"1": {
"name": "string.quoted.tailwindcss",
"patterns": [
{
"include": "#quotes"
}
]
},
"2": {
"name": "punctuation.definition.block.tailwindcss"
}
},
"patterns": [
{
"captures": {
"1": {
"patterns": [
{
"include": "#class-with-variants"
}
]
}
},
"match": "([^\\s]+)"
}
]
}
],
"repository": {
"brackets": {
"patterns": [
{
"captures": {
"1": {
"name": "meta.brace.square.tailwindcss"
},
"2": {
"patterns": [
{
"captures": {
"1": {
"name": "support.type.property-name.css.tailwindcss",
"patterns": [
{
"match": "(.*)",
"name": "property-name.tailwindcss"
}
]
},
"2": {
"name": "keyword.operator.assignment.tailwindcss"
},
"3": {
"patterns": [
{
"captures": {
"1": {
"name": "property-value.tailwindcss",
"patterns": [
{
"include": "#numbers"
},
{
"include": "#functions"
},
{
"include": "#selectors"
},
{
"include": "#commas"
}
]
}
},
"match": "(.*)",
"name": "support.constant.property-value.css.tailwindcss"
}
]
}
},
"match": "([\\w-]+)(:)(.*)"
},
{
"include": "#numbers"
},
{
"include": "#functions"
},
{
"include": "#selectors"
},
{
"include": "#commas"
}
]
},
"3": {
"name": "meta.brace.square.tailwindcss"
"patterns": [
{
"include": "#braces"
}
},
"match": "(\\[)(.*)(\\])"
]
}
]
},
"class": {
},
"patterns": [
{
"captures": {
"1": {
"name": "class.tailwindcss",
"patterns": [
{
"include": "#numbers"
},
{
"include": "#brackets"
},
{
"include": "#functions"
},
{
"include": "#slash"
},
{
"include": "#important"
}
]
}
},
"match": "[^:]*?(.*(?=$))",
"name": "support.type.property-name.css.tailwindcss"
}
]
},
"class-with-variants": {
"patterns": [
{
"include": "#negate"
},
{
"include": "#variant"
},
{
"include": "#class"
"include": "#multi-class-string-without-quotes"
}
]
},
Expand Down Expand Up @@ -269,6 +180,18 @@
"match": "(!(?=\\w))",
"name": "keyword.other.important.css.tailwindcss"
},
"multi-class-string-without-quotes": {
"captures": {
"1": {
"patterns": [
{
"include": "#tailwindcss-class-with-variants"
}
]
}
},
"match": "([^\\s]+?)"
},
"negate": {
"captures": {
"1": {
Expand Down Expand Up @@ -328,6 +251,45 @@
},
"match": "(/)"
},
"tailwindcss-class": {
"captures": {
"1": {
"name": "class.tailwindcss",
"patterns": [
{
"include": "#numbers"
},
{
"include": "#brackets"
},
{
"include": "#functions"
},
{
"include": "#slash"
},
{
"include": "#important"
}
]
}
},
"match": "[^:]*?([^\\s]+)",
"name": "support.type.property-name.css.tailwindcss"
},
"tailwindcss-class-with-variants": {
"patterns": [
{
"include": "#negate"
},
{
"include": "#variant"
},
{
"include": "#tailwindcss-class"
}
]
},
"variant": {
"patterns": [
{
Expand Down

0 comments on commit 1d16ebe

Please sign in to comment.