Skip to content

Commit

Permalink
(feat) highlight const tag (#1319)
Browse files Browse the repository at this point in the history
  • Loading branch information
Monkatraz authored Jan 9, 2022
1 parent c951ccd commit a0b01ff
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/svelte-vscode/syntaxes/svelte.tmLanguage.src.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ repository:
{ match: each|key, name: keyword.control.svelte },
{ match: await|then|catch, name: keyword.control.flow.svelte },
{ match: html, name: keyword.other.svelte },
{ match: debug, name: keyword.other.debugger.svelte }]}
{ match: debug, name: keyword.other.debugger.svelte },
{ match: const, name: storage.type.svelte }]}

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

# Const.
- begin: (?<=const.*?)\G
end: (?=})
patterns:
# Variable.
- begin: \G\s*([_$[:alpha:]][_$[:alnum:]]+)\s*
end: (?=\=)
beginCaptures: { 1: { name: variable.other.constant.svelte } }
# Expression (starting with "=").
- begin: (?=\=)
end: (?=})
patterns: [ include: source.ts#variable-initializer ]

# Each.
- begin: (?<=each.*?)\G
end: (?=})
Expand Down

0 comments on commit a0b01ff

Please sign in to comment.