Skip to content

Commit

Permalink
update Erlang grammar and queries
Browse files Browse the repository at this point in the history
The update to the grammar itself covers the case where the document
is a single expression without a trailing newline such as "min(A, B)".
A small change to the parser now parses these expressions correctly
which improves the display of the function head in the signature
help popup.

The update to the queries marks 'andalso', 'orelse', 'not', etc. as
`@keyword.operator` which improves the look - it looks odd to see
operators that are words highlighted the same as tokens like '->'
or '=:='.
  • Loading branch information
the-mikedavis authored and archseer committed May 25, 2022
1 parent 45dd540 commit 82da9bd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ language-server = { command = "erlang_ls" }

[[grammar]]
name = "erlang"
source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "3f611cfdc790214c3f9f9cf1658b3ae8039c54b8" }
source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "6cd8f956ada445b277de1581b5328ae8e8be9aac" }

[[language]]
name = "kotlin"
Expand Down
5 changes: 5 additions & 0 deletions runtime/queries/erlang/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@
operator: "/"
right: (integer) @constant.numeric.integer)

((binary_operator operator: _ @keyword.operator)
(#match? @keyword.operator "^\\w+$"))
((unary_operator operator: _ @keyword.operator)
(#match? @keyword.operator "^\\w+$"))

(binary_operator operator: _ @operator)
(unary_operator operator: _ @operator)
["/" ":" "#" "->"] @operator
Expand Down

0 comments on commit 82da9bd

Please sign in to comment.