on master help sign in
Update Erlang highlights

* Macros that start with underscore were incorrectly marked as 'comment.unused' rather than 'keyword.directive' due to an ordering issue of those two patterns. * Recognize escripts as Erlang by the shebang.

commitcdd6c8d91e7b29e9587babce5919af800400f28d authorMichael Davis <mcarsondavis@gmail.com> dateTue 20 Dec 2022, 09:27 (4 years ago) parentbb41a28
2 files changed+11−10
languages.toml+1 runtime/queries/erlang/highlights.scm+10−10
languages.toml+1
@@ -1317,6 +1317,7 @@ scope = "source.erlang"
13171317injection-regex = "erl(ang)?"
13181318file-types = ["erl", "hrl", "app", "rebar.config", "rebar.lock"]
13191319roots = ["rebar.config"]
1320+shebangs = ["escript"]
13201321comment-token = "%%"
13211322indent = { tab-width = 4, unit = " " }
13221323language-server = { command = "erlang_ls" }
runtime/queries/erlang/highlights.scm+10−10
@@ -65,6 +65,16 @@
6565(function_capture module: (atom) @namespace)
6666(function_capture function: (atom) @function)
6767
68+; Macros
69+(macro
70+ "?"+ @constant
71+ name: (_) @constant
72+ !arguments)
73+
74+(macro
75+ "?"+ @keyword.directive
76+ name: (_) @keyword.directive)
77+
6878; Ignored variables
6979((variable) @comment.discard
7080 (#match? @comment.discard "^_"))
@@ -125,16 +135,6 @@
125135(unary_operator operator: _ @operator)
126136["/" ":" "->"] @operator
127137
128−; Macros
129−(macro
130− "?"+ @constant
131− name: (_) @constant
132− !arguments)
133−
134−(macro
135− "?"+ @keyword.directive
136− name: (_) @keyword.directive)
137−
138138; Comments
139139(tripledot) @comment.discard
140140