Unnamed repository; edit this file 'description' to name the repository.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
; Tag names
(tag_name) @tag

; Erroneous/mismatched end tags
(erroneous_end_tag_name) @error

; DOCTYPE declaration
(doctype) @constant

; Attribute names
(attribute_name) @attribute

; Attribute values
(attribute_value) @string
(quoted_attribute_value) @string

; Comments
(comment) @comment

; Character entities
(entity) @string.special.symbol

; Text content
(text) @text

; Raw text in script/style
(raw_text) @none

; HTML punctuation
[
  "<"
  ">"
  "</"
  "/>"
  "<!"
] @punctuation.bracket

"=" @punctuation.delimiter

; Component tags (PascalCase)
((tag_name) @type (#match? @type "^[A-Z]"))

; Namespaced tags (svelte:component, svelte:self, etc.)
(tag_name
  namespace: (tag_namespace) @keyword
  ":" @punctuation.delimiter
  name: (tag_local_name) @tag)

; Tag member access (Foo.Bar)
(tag_name
  object: (tag_member) @type
  "." @punctuation.delimiter
  property: (tag_member) @tag)

; Directives (on:click, bind:value, etc.)
(attribute_directive) @keyword
(attribute_name ":" @punctuation.delimiter)
(attribute_identifier) @property
(attribute_modifier) @attribute
(attribute_modifiers "|" @punctuation.delimiter)

; Expressions
(expression) @embedded
(expression_value) @embedded

; Shorthand/spread attributes
(shorthand_attribute content: (_) @variable)

; Curly braces (expression context)
[
  "{"
  "}"
] @punctuation.bracket

"|" @punctuation.delimiter

; Comments inside tag attribute lists
(tag_comment kind: (line_comment) @comment)
(tag_comment kind: (block_comment) @comment)

; Block keywords
[
  "if"
  "each"
  "await"
  "key"
  "snippet"
  "else"
  "html"
  "debug"
  "const"
  "render"
  "attach"
  "as"
] @keyword.control

; Block end keywords ({/if}, {/each}, etc.)
(block_keyword) @keyword.control

; Block delimiters
(block_open) @punctuation.bracket
(block_close) @punctuation.bracket

(shorthand_kind) @keyword.control
(branch_kind) @keyword.control

; If block
(if_block expression: (expression) @embedded)
(else_if_clause expression: (expression_value) @embedded)

; Each block
(each_block expression: (expression) @embedded)
(each_block binding: (pattern) @variable)
(each_block index: (pattern) @variable)
(each_block key: (expression) @embedded)

; Await block
(await_block expression: (expression) @embedded)
(await_branch (pattern) @variable)
(await_block (pattern) @variable)
(orphan_branch (pattern) @variable)

; Key block
(key_block expression: (expression) @embedded)

; Snippet block
(snippet_block name: (snippet_name) @function)
(snippet_parameters parameter: (pattern) @variable)
(snippet_type_parameters) @type

; Malformed blocks
(block_sigil) @keyword.control

; Snippet/render punctuation
[
  "("
  ")"
  ","
] @punctuation.delimiter