diff options
| author | Ćukasz Niemier <lukasz@niemier.pl> | 2021-10-20 13:20:05 +0200 |
|---|---|---|
| committer | Santos Gallegos <stsewd@protonmail.com> | 2021-11-12 13:42:36 -0500 |
| commit | 2c2d4d89fd8111a1001603879af68d35dbf57739 (patch) | |
| tree | c9c8e839877040629638e1c06f2f65827a098ac8 /queries/elixir | |
| parent | Update lockfile.json (diff) | |
| download | nvim-treesitter-2c2d4d89fd8111a1001603879af68d35dbf57739.tar nvim-treesitter-2c2d4d89fd8111a1001603879af68d35dbf57739.tar.gz nvim-treesitter-2c2d4d89fd8111a1001603879af68d35dbf57739.tar.bz2 nvim-treesitter-2c2d4d89fd8111a1001603879af68d35dbf57739.tar.lz nvim-treesitter-2c2d4d89fd8111a1001603879af68d35dbf57739.tar.xz nvim-treesitter-2c2d4d89fd8111a1001603879af68d35dbf57739.tar.zst nvim-treesitter-2c2d4d89fd8111a1001603879af68d35dbf57739.zip | |
fix: Elixir non-doc sigils will no longer be flickering
It also adds support for colouring documentation metadata attributes
(ex. `@doc foo: :bar`).
Diffstat (limited to 'queries/elixir')
| -rw-r--r-- | queries/elixir/highlights.scm | 34 | ||||
| -rw-r--r-- | queries/elixir/injections.scm | 24 |
2 files changed, 27 insertions, 31 deletions
diff --git a/queries/elixir/highlights.scm b/queries/elixir/highlights.scm index dff497dbf..b69bdbcdd 100644 --- a/queries/elixir/highlights.scm +++ b/queries/elixir/highlights.scm @@ -40,7 +40,7 @@ ; Atoms & Keywords [ (atom) - (quoted_atom) + (quoted_atom) (keyword) (quoted_keyword) ] @symbol @@ -84,11 +84,11 @@ (stab_clause operator: _ @operator) ; Local Function Calls -(call target: (identifier) @function) +(call target: (identifier) @function) ; Remote Function Calls (call target: (dot left: [ - (atom) @type + (atom) @type (_) ] right: (identifier) @function) (arguments)) @@ -154,7 +154,7 @@ "do" "end" "fn" - "rescue" + "rescue" "when" "else" ] @keyword @@ -181,38 +181,34 @@ ]) ; Module attributes -(unary_operator - operator: "@" @constant +(unary_operator + operator: "@" @constant operand: [ (identifier) @constant (call target: (identifier) @constant)]) ; Sigils -(sigil +(sigil "~" @string.special ((sigil_name) @string.special) @_sigil_name - quoted_start: _ @string.special + quoted_start: _ @string.special quoted_end: _ @string.special ((sigil_modifiers) @string.special)? (#not-any-of? @_sigil_name "s" "S")) -(sigil +(sigil "~" @string ((sigil_name) @string) @_sigil_name - quoted_start: _ @string + quoted_start: _ @string (quoted_content) @string quoted_end: _ @string ((sigil_modifiers) @string)? (#any-of? @_sigil_name "s" "S")) ; Documentation -(unary_operator - operator: "@" @comment - operand: (call - target: (((identifier) @comment) @_identifier) - (arguments [ - (string) @comment - (charlist) @comment - (boolean) @comment - ])) +(unary_operator + operator: "@" @comment + operand: (call + target: ((identifier) @_identifier) + _) @comment (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) diff --git a/queries/elixir/injections.scm b/queries/elixir/injections.scm index 0451ec8d2..00d98b32e 100644 --- a/queries/elixir/injections.scm +++ b/queries/elixir/injections.scm @@ -1,21 +1,21 @@ -(sigil - (sigil_name) @_sigil_name - (quoted_content) @surface +(sigil + (sigil_name) @_sigil_name + (quoted_content) @surface (#eq? @_sigil_name "F")) -(sigil - (sigil_name) @_sigil_name - (quoted_content) @heex +(sigil + (sigil_name) @_sigil_name + (quoted_content) @heex (#eq? @_sigil_name "H")) -(sigil - (sigil_name) @_sigil_name - (quoted_content) @zig +(sigil + (sigil_name) @_sigil_name + (quoted_content) @zig (#eq? @_sigil_name "Z")) -(sigil - (sigil_name) @_sigil_name - (quoted_content) @regex +(sigil + (sigil_name) @_sigil_name + (quoted_content) @regex (#any-of? @_sigil_name "r" "R")) (comment) @comment |
