@@ -340,17 +340,26 @@ repository:
340340 # Matches attribute keyvalues. (and boolean attributes as well)
341341 # e.g. `class="my-class"`
342342 attributes-keyvalue :
343- begin : ([_$[:alpha:]][_\-$[:alnum:]]*)
344- beginCaptures : { 1: { name: entity.other.attribute-name.svelte } }
343+ begin : ((?:--)?[_$[:alpha:]][_\-$[:alnum:]]*)
344+ beginCaptures :
345+ 0 :
346+ patterns :
347+ # Matches if the key is a `--css-variable` attribute.
348+ - match : --.*
349+ name : support.type.property-name.svelte
350+ # Matches everything else.
351+ - match : .*
352+ name : entity.other.attribute-name.svelte
345353 end : (?=\s*+[^=\s])
346354 name : ' meta.attribute.$1.svelte'
347- patterns : [ include: '#attributes-value' ]
355+ patterns :
356+ - begin : ' ='
357+ beginCaptures : { 0: { name: punctuation.separator.key-value.svelte } }
358+ end : (?<=[^\s=])(?!\s*=)|(?=/?>)
359+ patterns : [include: '#attributes-value']
348360
349- # The value part of attribute keyvalues. e.g. `= "my-class"` in `class="my-class"`
361+ # The value part of attribute keyvalues. e.g. `"my-class"` in `class="my-class"`
350362 attributes-value :
351- begin : ' ='
352- beginCaptures : { 0: { name: punctuation.separator.key-value.svelte } }
353- end : (?<=[^\s=])(?!\s*=)|(?=/?>)
354363 patterns :
355364 # No quotes - just an interpolation expression.
356365 - include : ' #interpolation'
@@ -366,7 +375,7 @@ repository:
366375 - begin : (['"])
367376 end : \1
368377 beginCaptures : { 0: { name: punctuation.definition.string.begin.svelte } }
369- endCaptures : { 0: { name: punctuation.definition.string.end.svelte } }
378+ endCaptures : { 0: { name: punctuation.definition.string.end.svelte } }
370379 name : string.quoted.svelte
371380 patterns : [ include: '#interpolation' ]
372381
@@ -420,7 +429,10 @@ repository:
420429 end : (?=\s*+[^=\s])
421430 name : meta.directive.$1.svelte
422431 patterns :
423- - include : ' #attributes-value'
432+ - begin : ' ='
433+ beginCaptures : { 0: { name: punctuation.separator.key-value.svelte } }
434+ end : (?<=[^\s=])(?!\s*=)|(?=/?>)
435+ patterns : [include: '#attributes-value']
424436
425437 # ------
426438 # TAGS
0 commit comments