Skip to content

Commit 8faa154

Browse files
authored
(feat) highlight units in strings (#1316)
1 parent 839bdb7 commit 8faa154

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,9 +364,12 @@ repository:
364364
# No quotes - just an interpolation expression.
365365
- include: '#interpolation'
366366
# Units, meaning digit characters and an optional unit string. e.g. `15px`
367-
- match: ([0-9._]+[\w]{,4})(?=\s|/?>)
368-
name: constant.numeric.decimal.svelte
369-
patterns: [ include: '#interpolation' ]
367+
- match: (?:(['"])([0-9._]+[\w%]{,4})(\1))|(?:([0-9._]+[\w%]{,4})(?=\s|/?>))
368+
captures:
369+
1: { name: punctuation.definition.string.begin.svelte }
370+
2: { name: constant.numeric.decimal.svelte }
371+
3: { name: punctuation.definition.string.end.svelte }
372+
4: { name: constant.numeric.decimal.svelte }
370373
# Unquoted strings.
371374
- match: ([^\s"'=<>`/]|/(?!>))+
372375
name: string.unquoted.svelte

0 commit comments

Comments
 (0)