mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-19 20:00:07 -04:00
chore: query formatting
This commit is contained in:
parent
79975d6557
commit
57a8acf0c4
674 changed files with 18466 additions and 12648 deletions
|
|
@ -1,24 +1,27 @@
|
|||
; =============================================================================
|
||||
; generalized_strings
|
||||
|
||||
; regex in generalized_strings
|
||||
(generalized_string
|
||||
function: (identifier) @_string_prefix .
|
||||
function: (identifier) @_string_prefix
|
||||
.
|
||||
(string_content) @injection.content
|
||||
(#set! injection.language "regex")
|
||||
(#any-of? @_string_prefix "re" "rex"))
|
||||
|
||||
; format string in generalized_strings
|
||||
(generalized_string
|
||||
function: (identifier) @_string_prefix .
|
||||
function: (identifier) @_string_prefix
|
||||
.
|
||||
(string_content) @injection.content
|
||||
(#set! injection.language "nim_format_string")
|
||||
(#eq? @_string_prefix "fmt"))
|
||||
|
||||
; format string in normal strings with & prefix
|
||||
(prefix_expression
|
||||
operator: (operator) @_string_prefix .
|
||||
(_ (string_content) @injection.content)
|
||||
operator: (operator) @_string_prefix
|
||||
.
|
||||
(_
|
||||
(string_content) @injection.content)
|
||||
(#set! injection.language "nim_format_string")
|
||||
(#eq? @_string_prefix "&"))
|
||||
|
||||
|
|
@ -31,45 +34,47 @@
|
|||
|
||||
; =============================================================================
|
||||
; emit pragma
|
||||
|
||||
; C / CPP / OBJC / JAVASCRIPT
|
||||
; a `#<no whitespace><language name>`
|
||||
; has to directly precede the {.emit: "<language code>".} pragma
|
||||
|
||||
; eg.:
|
||||
; #objc
|
||||
; {.emit: "<objc code>".}
|
||||
; OR
|
||||
; #javascript
|
||||
; {.emit: "<javascript code>".}
|
||||
|
||||
; normal strings
|
||||
((comment (comment_content) @injection.language)
|
||||
((comment
|
||||
(comment_content) @injection.language)
|
||||
.
|
||||
(pragma_statement
|
||||
(pragma_list
|
||||
(colon_expression
|
||||
left: (identifier) @_emit_keyword (#eq? @_emit_keyword "emit")
|
||||
right: (_ (string_content) @injection.content)))))
|
||||
|
||||
left: (identifier) @_emit_keyword
|
||||
(#eq? @_emit_keyword "emit")
|
||||
right:
|
||||
(_
|
||||
(string_content) @injection.content)))))
|
||||
|
||||
; =============================================================================
|
||||
; asm statement
|
||||
|
||||
; works same as emit pragma, needs preceding comment with language name
|
||||
((comment (comment_content) @injection.language)
|
||||
((comment
|
||||
(comment_content) @injection.language)
|
||||
.
|
||||
(assembly_statement (_ (string_content) @injection.content)))
|
||||
(assembly_statement
|
||||
(_
|
||||
(string_content) @injection.content)))
|
||||
|
||||
; =============================================================================
|
||||
; comments
|
||||
|
||||
; NOTE: ts "comment" parser heavily impacts performance
|
||||
|
||||
; markdown parser in documentation_comment
|
||||
(documentation_comment (comment_content) @injection.content
|
||||
(documentation_comment
|
||||
(comment_content) @injection.content
|
||||
(#set! injection.language "markdown_inline"))
|
||||
|
||||
; markdown parser in block_documentation_comment
|
||||
(block_documentation_comment (comment_content) @injection.content
|
||||
(block_documentation_comment
|
||||
(comment_content) @injection.content
|
||||
(#set! injection.language "markdown"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue