aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--languages.toml10
-rw-r--r--runtime/queries/erlang/highlights.scm16
-rw-r--r--runtime/queries/erlang/injections.scm10
-rw-r--r--runtime/queries/erlang/locals.scm2
4 files changed, 24 insertions, 14 deletions
diff --git a/languages.toml b/languages.toml
index 608ec8a0..3e4084bf 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1711,17 +1711,9 @@ comment-token = "%%"
indent = { tab-width = 4, unit = " " }
language-servers = [ "erlang-ls" ]
-[language.auto-pairs]
-'(' = ')'
-'{' = '}'
-'[' = ']'
-'"' = '"'
-"'" = "'"
-'`' = "'"
-
[[grammar]]
name = "erlang"
-source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "731e50555a51f0d8635992b0e60dc98cc47a58d7" }
+source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "9d4b36a76d5519e3dbf1ec4f4b61bb1a293f584c" }
[[language]]
name = "kotlin"
diff --git a/runtime/queries/erlang/highlights.scm b/runtime/queries/erlang/highlights.scm
index 6d0ec36d..f09f6104 100644
--- a/runtime/queries/erlang/highlights.scm
+++ b/runtime/queries/erlang/highlights.scm
@@ -3,7 +3,7 @@
(attribute
name: (atom) @keyword
(arguments (atom) @namespace)
- (#match? @keyword "(module|behaviou?r)"))
+ (#any-of? @keyword "module" "behaviour" "behavior"))
(attribute
name: (atom) @keyword
@@ -50,12 +50,20 @@
name: (atom) @keyword
(arguments
(_) @keyword.directive)
- (#match? @keyword "ifn?def"))
+ (#any-of? @keyword "ifndef" "ifdef"))
(attribute
name: (atom) @keyword
module: (atom) @namespace
- (#match? @keyword "(spec|callback)"))
+ (#any-of? @keyword "spec" "callback"))
+
+(attribute
+ name: (atom) @keyword
+ (arguments [
+ (string)
+ (sigil)
+ ] @comment.block.documentation)
+ (#any-of? @keyword "doc" "moduledoc"))
; Functions
(function_clause name: (atom) @function)
@@ -84,7 +92,7 @@
((attribute
name: (atom) @keyword
(stab_clause
- pattern: (arguments (variable) @variable.parameter)
+ pattern: (arguments (variable)? @variable.parameter)
body: (variable)? @variable.parameter))
(#match? @keyword "(spec|callback)"))
; functions
diff --git a/runtime/queries/erlang/injections.scm b/runtime/queries/erlang/injections.scm
index 11cbd01e..798882f5 100644
--- a/runtime/queries/erlang/injections.scm
+++ b/runtime/queries/erlang/injections.scm
@@ -5,3 +5,13 @@
((comment (comment_content) @injection.content)
(#set! injection.language "comment"))
+
+; EEP-59 doc attributes use markdown by default.
+(attribute
+ name: (atom) @_attribute
+ (arguments [
+ (string (quoted_content) @injection.content)
+ (sigil (quoted_content) @injection.content)
+ ])
+ (#set! injection.language "markdown")
+ (#any-of? @_attribute "doc" "moduledoc"))
diff --git a/runtime/queries/erlang/locals.scm b/runtime/queries/erlang/locals.scm
index 7379926b..156e4038 100644
--- a/runtime/queries/erlang/locals.scm
+++ b/runtime/queries/erlang/locals.scm
@@ -1,7 +1,7 @@
; Specs and Callbacks
(attribute
(stab_clause
- pattern: (arguments (variable) @local.definition)
+ pattern: (arguments (variable)? @local.definition)
; If a spec uses a variable as the return type (and later a `when` clause to type it):
body: (variable)? @local.definition)) @local.scope