mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
injections(vue): inject typescript instead of js (#5577)
Interpolations (`{{valid js code}}`) and directive attributes
(`<element :directive="valid js code"`) can also be typescript code,
hence we can inject typescript instead of javascript here and still
be ok with highlights (bar some syntax differences between ts and js)
This commit is contained in:
parent
a82bba45fb
commit
80f66cdef1
2 changed files with 4 additions and 4 deletions
|
|
@ -57,12 +57,12 @@
|
|||
|
||||
((interpolation
|
||||
(raw_text) @injection.content)
|
||||
(#set! injection.language "javascript"))
|
||||
(#set! injection.language "typescript"))
|
||||
|
||||
(directive_attribute
|
||||
(quoted_attribute_value
|
||||
(attribute_value) @injection.content
|
||||
(#set! injection.language "javascript")))
|
||||
(#set! injection.language "typescript")))
|
||||
|
||||
(template_element
|
||||
(start_tag
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
<template>
|
||||
<span>{{"Text inside interpolation"}}</span>
|
||||
<!-- ^ javascript -->
|
||||
<!-- ^ typescript -->
|
||||
|
||||
<template lang="pug"> a(:href="url") some link title in pug: </template>
|
||||
<!-- ^ pug -->
|
||||
|
||||
<template v-if="'text inside directives'"></template>
|
||||
<!-- ^ javascript -->
|
||||
<!-- ^ typescript -->
|
||||
</template>
|
||||
<script> const foo = "1" </script>
|
||||
<!-- ^ javascript -->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue