Fix the order of some patterns in elixir highlight query

This commit is contained in:
Max Brunsfeld 2023-06-06 15:12:07 -07:00
parent 8dc679e74e
commit 7aeaa84657

View file

@ -1,20 +1,5 @@
["when" "and" "or" "not" "in" "not in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword ["when" "and" "or" "not" "in" "not in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword
(unary_operator
operator: "@" @comment.doc
operand: (call
target: (identifier) @comment.doc.__attribute__
(arguments
[
(string) @comment.doc
(charlist) @comment.doc
(sigil
quoted_start: _ @comment.doc
quoted_end: _ @comment.doc) @comment.doc
(boolean) @comment.doc
]))
(#match? @comment.doc.__attribute__ "^(moduledoc|typedoc|doc)$"))
(unary_operator (unary_operator
operator: "&" operator: "&"
operand: (integer) @operator) operand: (integer) @operator)
@ -84,6 +69,11 @@
quoted_start: _ @string.special quoted_start: _ @string.special
quoted_end: _ @string.special) @string.special quoted_end: _ @string.special) @string.special
(
(identifier) @comment.unused
(#match? @comment.unused "^_")
)
(call (call
target: [ target: [
(identifier) @function (identifier) @function
@ -99,17 +89,12 @@
(binary_operator (binary_operator
left: (identifier) @function left: (identifier) @function
operator: "when") operator: "when")
(binary_operator
operator: "|>"
right: (identifier))
]) ])
(#match? @keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp)$")) (#match? @keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp)$"))
(call
target: (identifier) @keyword
(arguments
(binary_operator
operator: "|>"
right: (identifier)))
(#match? @keyword "^(def|defdelegate|defguard|defguardp|defmacro|defmacrop|defn|defnp|defp)$"))
(binary_operator (binary_operator
operator: "|>" operator: "|>"
right: (identifier) @function) right: (identifier) @function)
@ -127,10 +112,18 @@
(#match? @constant.builtin "^(__MODULE__|__DIR__|__ENV__|__CALLER__|__STACKTRACE__)$") (#match? @constant.builtin "^(__MODULE__|__DIR__|__ENV__|__CALLER__|__STACKTRACE__)$")
) )
( (unary_operator
(identifier) @comment.unused operator: "@" @comment.doc
(#match? @comment.unused "^_") operand: (call
) target: (identifier) @__attribute__ @comment.doc
(arguments
[
(string)
(charlist)
(sigil)
(boolean)
] @comment.doc))
(#match? @__attribute__ "^(moduledoc|typedoc|doc)$"))
(comment) @comment (comment) @comment