mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-15 06:40:17 +00:00
bde1c95158
Before: ![Screenshot from 2024-09-03 20-36-48](https://github.com/user-attachments/assets/c4eca8c9-977b-461c-bb0a-77c0d94554b8) After: ![Screenshot from 2024-09-03 20-43-44](https://github.com/user-attachments/assets/d9b9653c-29c0-4273-85ee-040fb51af07c) Release Notes: - N/A --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
74 lines
1.6 KiB
Scheme
Executable file
74 lines
1.6 KiB
Scheme
Executable file
; injections.scm
|
|
; --------------
|
|
|
|
; match script tags without a lang tag
|
|
((script_element
|
|
(start_tag
|
|
(attribute
|
|
(attribute_name) @_name)*)
|
|
(raw_text) @content)
|
|
(#not-eq? @_name "lang")
|
|
(#set! "language" "javascript"))
|
|
|
|
; match javascript
|
|
((script_element
|
|
(start_tag
|
|
(attribute
|
|
(attribute_name) @_name
|
|
(quoted_attribute_value (attribute_value) @_value)))
|
|
(raw_text) @content)
|
|
(#eq? @_name "lang")
|
|
(#eq? @_value "js")
|
|
(#set! "language" "javascript"))
|
|
|
|
; match typescript
|
|
((script_element
|
|
(start_tag
|
|
(attribute
|
|
(attribute_name) @_name
|
|
(quoted_attribute_value (attribute_value) @_value)))
|
|
(raw_text) @content)
|
|
(#eq? @_name "lang")
|
|
(#eq? @_value "ts")
|
|
(#set! "language" "typescript"))
|
|
|
|
(style_element
|
|
(raw_text) @content
|
|
(#set! "language" "css"))
|
|
|
|
; match style tags without a lang tag
|
|
((style_element
|
|
(start_tag
|
|
(attribute
|
|
(attribute_name) @_name)*)
|
|
(raw_text) @content)
|
|
(#not-eq? @_name "lang")
|
|
(#set! "language" "css"))
|
|
|
|
; match css
|
|
((style_element
|
|
(start_tag
|
|
(attribute
|
|
(attribute_name) @_name
|
|
(quoted_attribute_value (attribute_value) @_value)))
|
|
(raw_text) @content)
|
|
(#eq? @_name "lang")
|
|
(#eq? @_value "css")
|
|
(#set! "language" "css"))
|
|
|
|
; match scss
|
|
((style_element
|
|
(start_tag
|
|
(attribute
|
|
(attribute_name) @_name
|
|
(quoted_attribute_value (attribute_value) @_value)))
|
|
(raw_text) @content)
|
|
(#eq? @_name "lang")
|
|
(#eq? @_value "scss")
|
|
(#set! "language" "scss"))
|
|
|
|
((raw_text_expr) @content
|
|
(#set! "language" "javascript"))
|
|
|
|
((raw_text_each) @content
|
|
(#set! "language" "javascript"))
|