Skip to content

Commit a0b01ff

Browse files
authored
(feat) highlight const tag (#1319)
1 parent c951ccd commit a0b01ff

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ repository:
215215
{ match: each|key, name: keyword.control.svelte },
216216
{ match: await|then|catch, name: keyword.control.flow.svelte },
217217
{ match: html, name: keyword.other.svelte },
218-
{ match: debug, name: keyword.other.debugger.svelte }]}
218+
{ match: debug, name: keyword.other.debugger.svelte },
219+
{ match: const, name: storage.type.svelte }]}
219220

220221
# Scopes special tag _block start nodes_ depending on what type they are, such as `#if` or `#await` blocks.
221222
special-tags-modes:
@@ -226,6 +227,19 @@ repository:
226227
name: meta.embedded.expression.svelte source.ts
227228
patterns: [ include: source.ts ]
228229

230+
# Const.
231+
- begin: (?<=const.*?)\G
232+
end: (?=})
233+
patterns:
234+
# Variable.
235+
- begin: \G\s*([_$[:alpha:]][_$[:alnum:]]+)\s*
236+
end: (?=\=)
237+
beginCaptures: { 1: { name: variable.other.constant.svelte } }
238+
# Expression (starting with "=").
239+
- begin: (?=\=)
240+
end: (?=})
241+
patterns: [ include: source.ts#variable-initializer ]
242+
229243
# Each.
230244
- begin: (?<=each.*?)\G
231245
end: (?=})

0 commit comments

Comments
 (0)