Skip to content

Commit

Permalink
wip: fix single line class attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
schoero committed Sep 3, 2024
1 parent 1d16ebe commit d2309f4
Showing 1 changed file with 112 additions and 63 deletions.
175 changes: 112 additions & 63 deletions syntaxes/tailwindcss.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"name": "tailwindcss syntax highlighting",
"patterns": [
{
"include": "#class-attribute"
"include": "#singleline-class-attribute"
},
{
"include": "#multiline-class-attribute"
}
],
"repository": {
Expand Down Expand Up @@ -87,53 +90,6 @@
},
"match": "(\\[)(.*)(\\])"
},
"class-attribute": {
"begin": "\\s*\\b(class|className)\\b\\s*(=)\\s*({)?([\"'`])",
"beginCaptures": {
"1": {
"name": "entity.other.attribute-name.tailwindcss"
},
"2": {
"name": "keyword.operator.assignment.tailwindcss"
},
"3": {
"patterns": [
{
"include": "#braces"
}
]
},
"4": {
"patterns": [
{
"include": "#quotes"
}
]
}
},
"end": "([\\4])(})?",
"endCaptures": {
"1": {
"patterns": [
{
"include": "#quotes"
}
]
},
"2": {
"patterns": [
{
"include": "#braces"
}
]
}
},
"patterns": [
{
"include": "#multi-class-string-without-quotes"
}
]
},
"commas": {
"captures": {
"1": {
Expand Down Expand Up @@ -190,7 +146,54 @@
]
}
},
"match": "([^\\s]+?)"
"match": "([^\\s]+)"
},
"multiline-class-attribute": {
"begin": "\\s*\\b(class|className)\\b\\s*(=)\\s*({)?\\s*([\"'`])",
"beginCaptures": {
"1": {
"name": "entity.other.attribute-name.tailwindcss"
},
"2": {
"name": "keyword.operator.assignment.tailwindcss"
},
"3": {
"patterns": [
{
"include": "#braces"
}
]
},
"4": {
"patterns": [
{
"include": "#quotes"
}
]
}
},
"end": "(\\4)\\s*(})?",
"endCaptures": {
"1": {
"patterns": [
{
"include": "#quotes"
}
]
},
"2": {
"patterns": [
{
"include": "#braces"
}
]
}
},
"patterns": [
{
"include": "#multi-class-string-without-quotes"
}
]
},
"negate": {
"captures": {
Expand Down Expand Up @@ -243,6 +246,56 @@
},
"match": "([>+~&\\*])"
},
"singleline-class-attribute": {
"captures": {
"1": {
"name": "entity.other.attribute-name.tailwindcss"
},
"2": {
"name": "keyword.operator.assignment.tailwindcss"
},
"3": {
"name": "punctuation.definition.block.tailwindcss"
},
"4": {
"name": "string.quoted.tailwindcss",
"patterns": [
{
"include": "#quotes"
}
]
},
"5": {
"name": "string.quoted.tailwindcss",
"patterns": [
{
"captures": {
"1": {
"patterns": [
{
"include": "#tailwindcss-class-with-variants"
}
]
}
},
"match": "([^\\s]+)"
}
]
},
"6": {
"name": "string.quoted.tailwindcss",
"patterns": [
{
"include": "#quotes"
}
]
},
"7": {
"name": "punctuation.definition.block.tailwindcss"
}
},
"match": "\\s*\\b(class|className)\\b\\s*(=)\\s*({)?\\s*([\"'`])\\s*(.*?)\\s*(\\4)(?:\\s*(?=\\s*}))?(})?"
},
"slash": {
"captures": {
"1": {
Expand Down Expand Up @@ -291,22 +344,18 @@
]
},
"variant": {
"patterns": [
{
"captures": {
"1": {
"name": "keyword.control.tailwindcss",
"patterns": [
{
"match": "(.*)",
"name": "variant.tailwindcss"
}
]
"captures": {
"1": {
"name": "keyword.control.tailwindcss",
"patterns": [
{
"match": "(.*)",
"name": "variant.tailwindcss"
}
},
"match": "([\\w-]+:)"
]
}
]
},
"match": "([\\w-]+:)"
}
},
"scopeName": "source.tailwindcss"
Expand Down

0 comments on commit d2309f4

Please sign in to comment.