Skip to content

Commit

Permalink
Fix - updated grammar.js to properly highlight 'else if' tokens in co…
Browse files Browse the repository at this point in the history
…nditional Svelte statements. These tokens appear in statements like {:else if /*condition*/ }.
  • Loading branch information
este36 committed Nov 7, 2024
1 parent ae5199d commit 4ae9c9b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ module.exports = grammar(HTML, {
'}',
),

_else_if_tag: _ => tag(':', 'else if'),
// Since 'else' and 'if' are separated by space, we cannot put them in a simple tag() like $._else_tag or $._if_start_tag
_else_if_tag: $ => seq(
tag(':', 'else'),
field('tag', 'if'),
),
else_if_start: $ => seq(
'{',
alias($._else_if_tag, $.block_tag),
Expand Down

0 comments on commit 4ae9c9b

Please sign in to comment.