Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save AlansCodeLog/9c6b02a7f31806ad38188f8d34514bf7 to your computer and use it in GitHub Desktop.
Save AlansCodeLog/9c6b02a7f31806ad38188f8d34514bf7 to your computer and use it in GitHub Desktop.
Treesitter Query to Get Vue Syntax Highlighting in Storybook Stories
; extends
(
(export_statement
declaration: (lexical_declaration (variable_declarator
type: (type_annotation
(type_identifier) @idenStory (#eq? @idenStory "Story")
)
value: (object
(pair
key: (property_identifier) @idenRender (#eq? @idenRender "render")
value: (_
body: (_ (object (pair
key: (property_identifier) @idenTemplate (#eq? @idenTemplate "template")
value: (
; remove quotes
(template_string) @injection.content (#offset! @injection.content 0 1 0 -1)
)
(#set! injection.language "vue")
(#set! injection.include-children)
)))
)
)
)
))
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment