Skip to content

Commit cdd6c8d

Browse files
the-mikedavisarchseer
authored andcommitted
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.
1 parent bb41a28 commit cdd6c8d

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

languages.toml

+1
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,7 @@ scope = "source.erlang"
13171317
injection-regex = "erl(ang)?"
13181318
file-types = ["erl", "hrl", "app", "rebar.config", "rebar.lock"]
13191319
roots = ["rebar.config"]
1320+
shebangs = ["escript"]
13201321
comment-token = "%%"
13211322
indent = { tab-width = 4, unit = " " }
13221323
language-server = { command = "erlang_ls" }

runtime/queries/erlang/highlights.scm

+10-10
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)