aboutsummaryrefslogtreecommitdiffstats
path: root/queries/elixir
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2024-01-06 15:05:50 +0900
committerChristian Clason <c.clason@uni-graz.at>2024-01-19 16:58:37 +0100
commit57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 (patch)
tree70bf645539882b88e6fa129cefd30986b89bbac3 /queries/elixir
parentci: add query lint job (diff)
downloadnvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.gz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.bz2
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.lz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.xz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.zst
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.zip
chore: query formatting
Diffstat (limited to 'queries/elixir')
-rw-r--r--queries/elixir/highlights.scm182
-rw-r--r--queries/elixir/indents.scm4
-rw-r--r--queries/elixir/injections.scm49
-rw-r--r--queries/elixir/locals.scm2
4 files changed, 122 insertions, 115 deletions
diff --git a/queries/elixir/highlights.scm b/queries/elixir/highlights.scm
index 5a9297fc7..57e299b17 100644
--- a/queries/elixir/highlights.scm
+++ b/queries/elixir/highlights.scm
@@ -15,15 +15,14 @@
"}"
] @punctuation.bracket
-[
- "%"
-] @punctuation.special
+"%" @punctuation.special
; Identifiers
(identifier) @variable
; Unused Identifiers
-((identifier) @comment (#lua-match? @comment "^_"))
+((identifier) @comment
+ (#lua-match? @comment "^_"))
; Comments
(comment) @comment @spell
@@ -43,7 +42,11 @@
] @string.special.symbol
; Interpolation
-(interpolation ["#{" "}"] @string.special)
+(interpolation
+ [
+ "#{"
+ "}"
+ ] @string.special)
; Escape sequences
(escape_sequence) @string.escape
@@ -69,82 +72,65 @@
; Operators
(operator_identifier) @operator
-(unary_operator operator: _ @operator)
+(unary_operator
+ operator: _ @operator)
-(binary_operator operator: _ @operator)
+(binary_operator
+ operator: _ @operator)
; Pipe Operator
-(binary_operator operator: "|>" right: (identifier) @function)
+(binary_operator
+ operator: "|>"
+ right: (identifier) @function)
-(dot operator: _ @operator)
+(dot
+ operator: _ @operator)
-(stab_clause operator: _ @operator)
+(stab_clause
+ operator: _ @operator)
; Local Function Calls
-(call target: (identifier) @function.call)
+(call
+ target: (identifier) @function.call)
; Remote Function Calls
-(call target: (dot left: [
- (atom) @type
- (_)
-] right: (identifier) @function.call) (arguments))
+(call
+ target:
+ (dot
+ left:
+ [
+ (atom) @type
+ (_)
+ ]
+ right: (identifier) @function.call)
+ (arguments))
; Definition Function Calls
-(call target: ((identifier) @keyword.function (#any-of? @keyword.function
- "def"
- "defdelegate"
- "defexception"
- "defguard"
- "defguardp"
- "defimpl"
- "defmacro"
- "defmacrop"
- "defmodule"
- "defn"
- "defnp"
- "defoverridable"
- "defp"
- "defprotocol"
- "defstruct"
- ))
- (arguments [
- (call (identifier) @function)
- (identifier) @function
- (binary_operator left: (call target: (identifier) @function) operator: "when")])?)
+(call
+ target:
+ ((identifier) @keyword.function
+ (#any-of? @keyword.function "def" "defdelegate" "defexception" "defguard" "defguardp" "defimpl" "defmacro" "defmacrop" "defmodule" "defn" "defnp" "defoverridable" "defp" "defprotocol" "defstruct"))
+ (arguments
+ [
+ (call
+ (identifier) @function)
+ (identifier) @function
+ (binary_operator
+ left:
+ (call
+ target: (identifier) @function)
+ operator: "when")
+ ])?)
; Kernel Keywords & Special Forms
-(call target: ((identifier) @keyword (#any-of? @keyword
- "alias"
- "case"
- "catch"
- "cond"
- "else"
- "for"
- "if"
- "import"
- "quote"
- "raise"
- "receive"
- "require"
- "reraise"
- "super"
- "throw"
- "try"
- "unless"
- "unquote"
- "unquote_splicing"
- "use"
- "with"
-)))
+(call
+ target:
+ ((identifier) @keyword
+ (#any-of? @keyword "alias" "case" "catch" "cond" "else" "for" "if" "import" "quote" "raise" "receive" "require" "reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with")))
; Special Constants
-((identifier) @constant.builtin (#any-of? @constant.builtin
- "__CALLER__"
- "__DIR__"
- "__ENV__"
- "__MODULE__"
- "__STACKTRACE__"
-))
+((identifier) @constant.builtin
+ (#any-of? @constant.builtin "__CALLER__" "__DIR__" "__ENV__" "__MODULE__" "__STACKTRACE__"))
; Reserved Keywords
[
@@ -170,14 +156,22 @@
; Capture Operator
(unary_operator
operator: "&"
- operand: [
- (integer) @operator
- (binary_operator
- left: [
- (call target: (dot left: (_) right: (identifier) @function))
- (identifier) @function
- ] operator: "/" right: (integer) @operator)
- ])
+ operand:
+ [
+ (integer) @operator
+ (binary_operator
+ left:
+ [
+ (call
+ target:
+ (dot
+ left: (_)
+ right: (identifier) @function))
+ (identifier) @function
+ ]
+ operator: "/"
+ right: (integer) @operator)
+ ])
; Non-String Sigils
(sigil
@@ -201,24 +195,30 @@
; Module attributes
(unary_operator
operator: "@"
- operand: [
- (identifier)
- (call target: (identifier))
- ] @constant) @constant
+ operand:
+ [
+ (identifier)
+ (call
+ target: (identifier))
+ ] @constant) @constant
; Documentation
(unary_operator
operator: "@"
- operand: (call
- target: ((identifier) @_identifier (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) @comment.documentation
- (arguments [
- (string)
- (boolean)
- (charlist)
- (sigil
- "~" @comment.documentation
- ((sigil_name) @comment.documentation)
- quoted_start: _ @comment.documentation
- (quoted_content) @comment.documentation
- quoted_end: _ @comment.documentation)
- ] @comment.documentation))) @comment.documentation
+ operand:
+ (call
+ target:
+ ((identifier) @_identifier
+ (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) @comment.documentation
+ (arguments
+ [
+ (string)
+ (boolean)
+ (charlist)
+ (sigil
+ "~" @comment.documentation
+ ((sigil_name) @comment.documentation)
+ quoted_start: _ @comment.documentation
+ (quoted_content) @comment.documentation
+ quoted_end: _ @comment.documentation)
+ ] @comment.documentation))) @comment.documentation
diff --git a/queries/elixir/indents.scm b/queries/elixir/indents.scm
index 0ba8fd442..5470b6422 100644
--- a/queries/elixir/indents.scm
+++ b/queries/elixir/indents.scm
@@ -20,4 +20,6 @@
] @indent.end @indent.branch
; Elixir pipelines are not indented, but other binary operator chains are
-((binary_operator operator: _ @_operator) @indent.begin (#not-eq? @_operator "|>"))
+((binary_operator
+ operator: _ @_operator) @indent.begin
+ (#not-eq? @_operator "|>"))
diff --git a/queries/elixir/injections.scm b/queries/elixir/injections.scm
index 1f0b31f07..b580f2ea6 100644
--- a/queries/elixir/injections.scm
+++ b/queries/elixir/injections.scm
@@ -1,56 +1,61 @@
; Comments
-((comment) @injection.content
- (#set! injection.language "comment"))
+((comment) @injection.content
+ (#set! injection.language "comment"))
; Documentation
(unary_operator
operator: "@"
- operand: (call
- target: ((identifier) @_identifier (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc"))
- (arguments [
- (string (quoted_content) @injection.content)
- (sigil (quoted_content) @injection.content)
- ])
- (#set! injection.language "markdown")))
+ operand:
+ (call
+ target:
+ ((identifier) @_identifier
+ (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc"))
+ (arguments
+ [
+ (string
+ (quoted_content) @injection.content)
+ (sigil
+ (quoted_content) @injection.content)
+ ])
+ (#set! injection.language "markdown")))
; HEEx
(sigil
(sigil_name) @_sigil_name
(quoted_content) @injection.content
- (#eq? @_sigil_name "H")
- (#set! injection.language "heex"))
+ (#eq? @_sigil_name "H")
+ (#set! injection.language "heex"))
; Surface
(sigil
(sigil_name) @_sigil_name
(quoted_content) @injection.content
- (#eq? @_sigil_name "F")
- (#set! injection.language "surface"))
+ (#eq? @_sigil_name "F")
+ (#set! injection.language "surface"))
; Zigler
(sigil
(sigil_name) @_sigil_name
(quoted_content) @injection.content
- (#any-of? @_sigil_name "E" "L")
- (#set! injection.language "eex"))
+ (#any-of? @_sigil_name "E" "L")
+ (#set! injection.language "eex"))
(sigil
(sigil_name) @_sigil_name
(quoted_content) @injection.content
- (#any-of? @_sigil_name "z" "Z")
- (#set! injection.language "zig"))
+ (#any-of? @_sigil_name "z" "Z")
+ (#set! injection.language "zig"))
; Regex
(sigil
(sigil_name) @_sigil_name
(quoted_content) @injection.content
- (#any-of? @_sigil_name "r" "R")
- (#set! injection.language "regex"))
+ (#any-of? @_sigil_name "r" "R")
+ (#set! injection.language "regex"))
; Json
(sigil
(sigil_name) @_sigil_name
(quoted_content) @injection.content
- (#any-of? @_sigil_name "j" "J")
- (#set! injection.language "json"))
-
+ (#any-of? @_sigil_name "j" "J")
+ (#set! injection.language "json"))
diff --git a/queries/elixir/locals.scm b/queries/elixir/locals.scm
index 59e55eae0..003ec4b1b 100644
--- a/queries/elixir/locals.scm
+++ b/queries/elixir/locals.scm
@@ -5,7 +5,7 @@
; Module Definitions
(call
- target:
+ target:
((identifier) @_identifier
(#eq? @_identifier "defmodule"))
(arguments