svelte: Adjust block keyword highlighting (#19418)
This PR adjusts the highlights for `{#each ...}` and `{#if ...}` expression blocks to use keyword highlighting. Extracted from https://github.com/zed-industries/zed/pull/18052. Release Notes: - N/A Co-authored-by: Albert Marashi <albert@lumina.earth>
This commit is contained in:
parent
35f2f2aac4
commit
5508832ba6
2 changed files with 8 additions and 9 deletions
|
@ -20,6 +20,7 @@
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
; Style self-closing component attributes as @tag.property
|
||||||
(self_closing_tag
|
(self_closing_tag
|
||||||
(
|
(
|
||||||
(tag_name) @_tag_name
|
(tag_name) @_tag_name
|
||||||
|
@ -77,19 +78,19 @@
|
||||||
; Treating (if, each, ...) as a keyword inside of blocks
|
; Treating (if, each, ...) as a keyword inside of blocks
|
||||||
; like {#if ...} or {#each ...}
|
; like {#if ...} or {#each ...}
|
||||||
(block_start_tag
|
(block_start_tag
|
||||||
tag: _ @tag.keyword
|
tag: _ @keyword
|
||||||
)
|
)
|
||||||
|
|
||||||
(block_tag
|
(block_tag
|
||||||
tag: _ @tag.keyword
|
tag: _ @keyword
|
||||||
)
|
)
|
||||||
|
|
||||||
(block_end_tag
|
(block_end_tag
|
||||||
tag: _ @tag.keyword
|
tag: _ @keyword
|
||||||
)
|
)
|
||||||
|
|
||||||
(expression_tag
|
(expression_tag
|
||||||
tag: _ @tag.keyword
|
tag: _ @keyword
|
||||||
)
|
)
|
||||||
|
|
||||||
; Style quoted string attribute values
|
; Style quoted string attribute values
|
||||||
|
|
|
@ -55,7 +55,7 @@
|
||||||
(#set! "language" "ts")
|
(#set! "language" "ts")
|
||||||
)
|
)
|
||||||
|
|
||||||
; Match style tags with a lang attribute
|
; Match <style lang="language"> as the specified language
|
||||||
(style_element
|
(style_element
|
||||||
(start_tag
|
(start_tag
|
||||||
(attribute
|
(attribute
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
(raw_text) @content
|
(raw_text) @content
|
||||||
)
|
)
|
||||||
|
|
||||||
; Match style tags without a lang attribute
|
; Match <style> tags without a lang attribute as CSS
|
||||||
(style_element
|
(style_element
|
||||||
(start_tag
|
(start_tag
|
||||||
(attribute
|
(attribute
|
||||||
|
@ -81,6 +81,4 @@
|
||||||
(#set! language "css")
|
(#set! language "css")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
; Downstream TODO: Style @component comments as markdown
|
||||||
; Downstream TODO: Style highlighting for `style:background="red"` and `style="background: red"` strings
|
|
||||||
; Downstream TODO: Style component comments as markdown
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue