mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-02 19:46:58 -04:00
refactor(svelte): Remove duplicated queries
These injection queries are defined already in html_tags, remove them Signed-off-by: Pham Huy Hoang <hoangtun0810@gmail.com>
This commit is contained in:
parent
6f4b9b190b
commit
28baed7698
2 changed files with 43 additions and 7 deletions
|
|
@ -4,16 +4,13 @@
|
|||
(style_element
|
||||
(start_tag
|
||||
(attribute
|
||||
(attribute_name) @_attr
|
||||
(quoted_attribute_value (attribute_value) @_lang)))
|
||||
(raw_text) @scss)
|
||||
(#eq? @_attr "lang")
|
||||
(#any-of? @_lang "scss" "postcss" "less")
|
||||
)
|
||||
|
||||
((attribute
|
||||
(attribute_name) @_attr
|
||||
(quoted_attribute_value (attribute_value) @css))
|
||||
(#eq? @_attr "style"))
|
||||
|
||||
[
|
||||
(raw_text_expr)
|
||||
(raw_text_each)
|
||||
|
|
@ -23,9 +20,9 @@
|
|||
(script_element
|
||||
(start_tag
|
||||
(attribute
|
||||
(attribute_name) @_attr
|
||||
(quoted_attribute_value (attribute_value) @_lang)))
|
||||
(raw_text) @typescript)
|
||||
(#eq? @_attr "lang")
|
||||
(#any-of? @_lang "ts" "typescript")
|
||||
)
|
||||
|
||||
(comment) @comment
|
||||
|
|
|
|||
39
tests/query/injections/svelte/test-svelte-injections.svelte
Normal file
39
tests/query/injections/svelte/test-svelte-injections.svelte
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<script>
|
||||
import Button from "./Button.svelte";
|
||||
// ^ javascript
|
||||
</script>
|
||||
<script lang="ts">
|
||||
const foo: number = 1
|
||||
// ^ typescript
|
||||
</script>
|
||||
|
||||
<style>
|
||||
main {
|
||||
font-family: sans-serif;
|
||||
text-align: center;
|
||||
/* ^ css
|
||||
*/
|
||||
}
|
||||
</style>
|
||||
<style lang="scss">
|
||||
main {
|
||||
font-family: sans-serif;
|
||||
text-align: center;
|
||||
&:hover {
|
||||
// ^ scss
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<main>
|
||||
<h1>Test file</h1>
|
||||
{#each someItems as someItem}
|
||||
<!-- ^ javascript
|
||||
-->
|
||||
<div>{someItem}</div>
|
||||
<!-- ^ javascript
|
||||
-->
|
||||
{/each}
|
||||
<Button />
|
||||
<button on:click={() => foo++}></button>
|
||||
</main>
|
||||
Loading…
Add table
Add a link
Reference in a new issue