nvim-treesitter/queries/elixir/highlights.scm

155 lines
2.1 KiB
Scheme
Raw Normal View History

(ERROR) @error
2021-05-17 20:34:05 +02:00
[
"("
")"
"<<"
">>"
2021-05-17 20:34:05 +02:00
"["
"]"
"{"
"}"
] @punctuation.bracket
[
","
"->"
"."
] @punctuation.delimiter
2021-05-17 20:34:05 +02:00
[
(sigil_start)
(sigil_end)
(heredoc_start)
(heredoc_end)
] @punctuation.special
2021-05-17 20:34:05 +02:00
(interpolation ["#{" "}"] @punctuation.special)
2021-05-17 20:34:05 +02:00
2021-05-14 21:23:58 +02:00
[
"after"
"and"
"catch"
2021-05-14 21:23:58 +02:00
"do"
"else"
2021-05-14 21:23:58 +02:00
"end"
"fn"
2021-05-14 21:23:58 +02:00
"in"
"not in"
"not"
2021-05-14 21:23:58 +02:00
"or"
"rescue"
"when"
] @keyword
[
(comment)
(unused_identifier)
] @comment
[
(heredoc_content)
(sigil_content)
(string)
] @string
2021-05-14 21:23:58 +02:00
; __MODULE__ and friends
(special_identifier) @constant.builtin
(map ["%{" "}"] @constructor)
(struct ["%" "{" "}"] @constructor)
(binary_op operator: _ @operator)
2021-05-14 21:23:58 +02:00
(unary_op operator: _ @operator)
2021-05-14 21:23:58 +02:00
(atom) @symbol
(keyword) @parameter
[
(true)
(false)
] @boolean
(nil) @constant.builtin
2021-05-14 21:23:58 +02:00
(sigil) @string.special
2021-05-14 21:23:58 +02:00
(identifier) @variable
2021-05-14 21:23:58 +02:00
(module) @type
2021-05-14 21:23:58 +02:00
(function_identifier) @function
2021-05-14 21:23:58 +02:00
(integer) @number
2021-05-14 21:23:58 +02:00
(float) @float
2021-05-14 21:23:58 +02:00
[
(sigil_start)
(sigil_end)
] @string.special
2021-05-14 21:23:58 +02:00
; Module attributes as "attributes"
(unary_op operator: "@" @attribute [
(call function: (function_identifier) @attribute)
(identifier) @attribute
])
; Erlang modules (when they are the remote of a function call) are highlighted as Elixir modules
(dot_call remote: (atom) @type)
(call (function_identifier) @keyword.function (#any-of? @keyword.function
"def"
"defdelegate"
"defexception"
"defguard"
"defguardp"
"defimpl"
"defmacro"
"defmacrop"
"defmodule"
"defoverridable"
"defp"
"defprotocol"
"defstruct"
) [(identifier) @function (_)]) ; 0-arity function def without parens
(call (function_identifier) @include (#any-of? @include
"alias"
"import"
"require"
"use"
))
(call (function_identifier) @conditional (#any-of? @conditional
"case"
"cond"
"else"
"if"
"unless"
"with"
"receive"
))
(call (function_identifier) @exception (#any-of? @exception
"raise"
"reraise"
"throw"
"try"
))
(call (function_identifier) @repeat (#any-of? @repeat
"for"
))
(call (function_identifier) @keyword.function (#any-of? @keyword.function
"describe"
"setup"
"setup_all"
"test"
"using"
))