Given a tree-sitter tree for some HTML elements:
<script>console.log('should parse as js')</script>
<script async defer>console.log('works')</script>
(script_element
(start_tag
(tag_name))
(raw_text
; ... etc
)
(end_tag
(tag_name)))
(script_element
(start_tag
(tag_name)))
(attribute
(attribute_name))
(attribute
(attribute_name))
(raw_text
; ... etc
)
(end_tag
(tag_name)))
Broken Query
This query fails when used in neovim's tree-sitter html grammar injections.scm
, returning an invalid field
error
(script_element
(start_tag !attribute))
How would I query for <script>
elements which do not have any attributes? Is it necessary for the grammar to assign a field name to the child in order for queries to negate it?