Skip to content

Commit 455efcc

Browse files
authored
(feat) add syntax highlighting for style:foo props (#1327)
1 parent c57a1ab commit 455efcc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/svelte-vscode/syntaxes/svelte.tmLanguage.src.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ repository:
390390
- { match: on|use|bind, name: keyword.control.svelte }
391391
- { match: transition|in|out|animate, name: keyword.other.animation.svelte }
392392
- { match: let, name: storage.type.svelte }
393-
- { match: class, name: entity.other.attribute-name.svelte }
393+
- { match: class|style, name: entity.other.attribute-name.svelte }
394394

395395
# For Svelte element directives. Scopes the 'click' part in `on:click`.
396396
# The scope of the variable should represent what data type it generally is.
@@ -400,7 +400,7 @@ repository:
400400
- { match: '(?<=(on):).*$', name: entity.name.type.svelte }
401401
- { match: '(?<=(bind):).*$', name: variable.parameter.svelte }
402402
- { match: '(?<=(use|transition|in|out|animate):).*$', name: variable.function.svelte }
403-
- { match: '(?<=(let|class):).*$', name: variable.parameter.svelte }
403+
- { match: '(?<=(let|class|style):).*$', name: variable.parameter.svelte }
404404

405405
# For directives that may be better suited using different scopes if assigned to something.
406406
# e.g. `class:var={var}` is different to `class:var`.
@@ -411,15 +411,16 @@ repository:
411411
# Makes 'bind:this' display like `this` would in JS.
412412
- { match: '(?<=(bind):)this$', name: variable.language.svelte }
413413
# If other keywords are patched in in the future, they can easily be added here.
414-
- { match: '(?<=(bind):).*$', name: entity.name.type.svelte }
415-
- { match: '(?<=(class):).*$', name: entity.other.attribute-name.class.svelte }
414+
- { match: '(?<=(bind):).*$', name: entity.name.type.svelte }
415+
- { match: '(?<=(class):).*$', name: entity.other.attribute-name.class.svelte }
416+
- { match: '(?<=(style):).*$', name: support.type.property-name.svelte }
416417
# Defaults to the non-assignment version for everything else.
417418
- include: '#attributes-directives-types'
418419

419420
# Matches Svelte element directives, e.g. `on:click|preventDefault={var}`
420421
attributes-directives:
421422
# If something is added to attributes-directives-keywords, it must be added to the begin-regex, too.
422-
begin: (?<!<)(on|use|bind|transition|in|out|animate|let|class)(:)(?:([_$[:alpha:]][_\-$[:alnum:]]*(?=\s*=))|([_$[:alpha:]][_\-$[:alnum:]]*))((\|\w+)*)
423+
begin: (?<!<)(on|use|bind|transition|in|out|animate|let|class|style)(:)(?:((?:--)?[_$[:alpha:]][_\-$[:alnum:]]*(?=\s*=))|((?:--)?[_$[:alpha:]][_\-$[:alnum:]]*))((\|\w+)*)
423424
beginCaptures:
424425
1: { patterns: [ include: '#attributes-directives-keywords' ] }
425426
2: { name: punctuation.definition.keyword.svelte }

0 commit comments

Comments
 (0)