mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-20 04:10:06 -04:00
Fix documentation highlights, formatting
This commit is contained in:
parent
725ef8fc18
commit
6bd551d3b7
1 changed files with 35 additions and 45 deletions
|
|
@ -19,16 +19,14 @@
|
||||||
"%"
|
"%"
|
||||||
] @punctuation.special
|
] @punctuation.special
|
||||||
|
|
||||||
; Parser errors
|
; Parser Errors
|
||||||
(ERROR) @error
|
(ERROR) @error
|
||||||
|
|
||||||
; Identifiers
|
; Identifiers
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
|
|
||||||
; Unused identifiers
|
; Unused Identifiers
|
||||||
((identifier) @comment (#match? @comment
|
((identifier) @comment (#match? @comment "^_"))
|
||||||
"^_"
|
|
||||||
))
|
|
||||||
|
|
||||||
; Comments
|
; Comments
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
|
|
@ -74,22 +72,21 @@
|
||||||
; Operators
|
; Operators
|
||||||
(operator_identifier) @operator
|
(operator_identifier) @operator
|
||||||
|
|
||||||
(unary_operator
|
(unary_operator operator: _ @operator)
|
||||||
operator: _ @operator)
|
|
||||||
|
|
||||||
(binary_operator
|
(binary_operator operator: _ @operator)
|
||||||
operator: _ @operator)
|
|
||||||
|
|
||||||
(dot
|
; Pipe Operator
|
||||||
operator: _ @operator)
|
(binary_operator operator: "|>" right: (identifier) @function)
|
||||||
|
|
||||||
(stab_clause
|
(dot operator: _ @operator)
|
||||||
operator: _ @operator)
|
|
||||||
|
(stab_clause operator: _ @operator)
|
||||||
|
|
||||||
; Local Function Calls
|
; Local Function Calls
|
||||||
(call target: (identifier) @function)
|
(call target: (identifier) @function)
|
||||||
|
|
||||||
; Remove Function Calls
|
; Remote Function Calls
|
||||||
(call target: (dot left: [
|
(call target: (dot left: [
|
||||||
(atom) @type
|
(atom) @type
|
||||||
(_)
|
(_)
|
||||||
|
|
@ -114,8 +111,7 @@
|
||||||
"defstruct"
|
"defstruct"
|
||||||
)) (arguments [
|
)) (arguments [
|
||||||
(identifier) @function
|
(identifier) @function
|
||||||
(binary_operator left: (identifier) @function operator: "when")
|
(binary_operator left: (identifier) @function operator: "when")])?)
|
||||||
])?)
|
|
||||||
|
|
||||||
; Kernel Keywords & Special Forms
|
; Kernel Keywords & Special Forms
|
||||||
(call target: ((identifier) @keyword (#any-of? @keyword
|
(call target: ((identifier) @keyword (#any-of? @keyword
|
||||||
|
|
@ -176,40 +172,15 @@
|
||||||
left: [
|
left: [
|
||||||
(call target: (dot left: (_) right: (identifier) @function))
|
(call target: (dot left: (_) right: (identifier) @function))
|
||||||
(identifier) @function
|
(identifier) @function
|
||||||
]
|
] operator: "/" right: (integer) @operator)
|
||||||
operator: "/"
|
])
|
||||||
right: (integer) @operator
|
|
||||||
)
|
|
||||||
])
|
|
||||||
|
|
||||||
; Pipe Operator
|
|
||||||
(binary_operator
|
|
||||||
operator: "|>"
|
|
||||||
right: (identifier) @function)
|
|
||||||
|
|
||||||
; Module attributes
|
; Module attributes
|
||||||
(unary_operator
|
(unary_operator
|
||||||
operator: "@" @constant
|
operator: "@" @constant
|
||||||
operand: [
|
operand: [
|
||||||
(identifier) @constant
|
(identifier) @constant
|
||||||
(call target: (identifier) @constant)
|
(call target: (identifier) @constant)])
|
||||||
])
|
|
||||||
|
|
||||||
; Documentation
|
|
||||||
(unary_operator
|
|
||||||
operator: "@" @comment
|
|
||||||
operand: (call
|
|
||||||
target: ((identifier) @comment) @_identifier
|
|
||||||
(arguments
|
|
||||||
[
|
|
||||||
(string) @comment
|
|
||||||
(charlist) @comment
|
|
||||||
(sigil
|
|
||||||
quoted_start: _ @comment
|
|
||||||
quoted_end: _ @comment) @comment
|
|
||||||
(boolean) @comment
|
|
||||||
]))
|
|
||||||
(#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc"))
|
|
||||||
|
|
||||||
; Sigils
|
; Sigils
|
||||||
(sigil
|
(sigil
|
||||||
|
|
@ -224,7 +195,26 @@
|
||||||
"~" @string
|
"~" @string
|
||||||
((sigil_name) @string) @_sigil_name
|
((sigil_name) @string) @_sigil_name
|
||||||
quoted_start: _ @string
|
quoted_start: _ @string
|
||||||
|
(quoted_content) @string
|
||||||
quoted_end: _ @string
|
quoted_end: _ @string
|
||||||
((sigil_modifiers) @string)?
|
((sigil_modifiers) @string)?
|
||||||
(#any-of? @_sigil_name "s" "S")) @string
|
(#any-of? @_sigil_name "s" "S"))
|
||||||
|
|
||||||
|
; Documentation
|
||||||
|
(unary_operator
|
||||||
|
operator: "@" @comment
|
||||||
|
operand: (call
|
||||||
|
target: (((identifier) @comment) @_identifier
|
||||||
|
(#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc"))
|
||||||
|
(arguments [
|
||||||
|
(string) @comment
|
||||||
|
(charlist) @comment
|
||||||
|
(sigil
|
||||||
|
"~" @comment
|
||||||
|
(sigil_name) @comment
|
||||||
|
quoted_start: _ @comment
|
||||||
|
(quoted_content) @comment
|
||||||
|
quoted_end: _ @comment
|
||||||
|
((sigil_modifiers) @comment)?)
|
||||||
|
(boolean) @comment
|
||||||
|
])))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue