aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Davis2022-06-01 23:40:05 +0000
committerBlaž Hrastnik2022-06-07 11:03:31 +0000
commit7a9147489e8c058561bb37834c791b027fb0b4ae (patch)
tree1969e1de9a2f20172e5a507ca627571a75d1b021
parent9f8df05d96b0c475fefe079bca01c23eb492e6bb (diff)
add textobject queries for erlang
-rw-r--r--book/src/generated/lang-support.md2
-rw-r--r--languages.toml2
-rw-r--r--runtime/queries/erlang/highlights.scm2
-rw-r--r--runtime/queries/erlang/textobjects.scm8
4 files changed, 11 insertions, 3 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index 1d9b89a4..8d8936ae 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -18,7 +18,7 @@
| elixir | ✓ | | | `elixir-ls` |
| elm | ✓ | | | `elm-language-server` |
| erb | ✓ | | | |
-| erlang | ✓ | | | `erlang_ls` |
+| erlang | ✓ | ✓ | | `erlang_ls` |
| fish | ✓ | ✓ | ✓ | |
| gdscript | ✓ | | ✓ | |
| git-attributes | ✓ | | | |
diff --git a/languages.toml b/languages.toml
index 7ab8ff84..6ab394b7 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1049,7 +1049,7 @@ language-server = { command = "erlang_ls" }
[[grammar]]
name = "erlang"
-source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "481e7f8ddf27f07a47d1531b6e2b154b89ece31d" }
+source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "c0ebc82600caaf4339f2b00691f958e9df97c065" }
[[language]]
name = "kotlin"
diff --git a/runtime/queries/erlang/highlights.scm b/runtime/queries/erlang/highlights.scm
index bea3871a..0cb60ca9 100644
--- a/runtime/queries/erlang/highlights.scm
+++ b/runtime/queries/erlang/highlights.scm
@@ -58,7 +58,7 @@
(#eq? @keyword "(spec|callback)"))
; Functions
-(function name: (atom) @function)
+(function_clause name: (atom) @function)
(call module: (atom) @module)
(call function: (atom) @function)
(stab_clause name: (atom) @function)
diff --git a/runtime/queries/erlang/textobjects.scm b/runtime/queries/erlang/textobjects.scm
new file mode 100644
index 00000000..c46b5c6f
--- /dev/null
+++ b/runtime/queries/erlang/textobjects.scm
@@ -0,0 +1,8 @@
+(function_clause
+ pattern: (arguments (_)? @parameter.inside)
+ body: (_) @function.inside) @function.around
+
+(anonymous_function
+ (stab_clause body: (_) @function.inside)) @function.around
+
+(comment (comment_content) @comment.inside) @comment.around