Skip to content

Commit

Permalink
Update Erlang highlights
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
the-mikedavis authored and archseer committed Mar 14, 2023
1 parent bb41a28 commit cdd6c8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,7 @@ scope = "source.erlang"
injection-regex = "erl(ang)?"
file-types = ["erl", "hrl", "app", "rebar.config", "rebar.lock"]
roots = ["rebar.config"]
shebangs = ["escript"]
comment-token = "%%"
indent = { tab-width = 4, unit = " " }
language-server = { command = "erlang_ls" }
Expand Down
20 changes: 10 additions & 10 deletions runtime/queries/erlang/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@
(function_capture module: (atom) @namespace)
(function_capture function: (atom) @function)

; Macros
(macro
"?"+ @constant
name: (_) @constant
!arguments)

(macro
"?"+ @keyword.directive
name: (_) @keyword.directive)

; Ignored variables
((variable) @comment.discard
(#match? @comment.discard "^_"))
Expand Down Expand Up @@ -125,16 +135,6 @@
(unary_operator operator: _ @operator)
["/" ":" "->"] @operator

; Macros
(macro
"?"+ @constant
name: (_) @constant
!arguments)

(macro
"?"+ @keyword.directive
name: (_) @keyword.directive)

; Comments
(tripledot) @comment.discard

Expand Down

0 comments on commit cdd6c8d

Please sign in to comment.