From ad36a024da4dae0cc096cae8ab83740507bc8d8a Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sun, 17 Apr 2022 12:46:22 -0500 Subject: [PATCH] Update tree-sitters Erlang and HEEx (#2149) --- languages.toml | 2 +- runtime/queries/erlang/highlights.scm | 26 +++++++++++++------------- runtime/queries/heex/highlights.scm | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/languages.toml b/languages.toml index 70baabaf..fd14fc57 100644 --- a/languages.toml +++ b/languages.toml @@ -974,7 +974,7 @@ language-server = { command = "erlang_ls" } [[grammar]] name = "erlang" -source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "1e81393b8f0a81b35ff1679a9420fafbd2cf3511" } +source = { git = "https://github.com/the-mikedavis/tree-sitter-erlang", rev = "3f611cfdc790214c3f9f9cf1658b3ae8039c54b8" } [[language]] name = "kotlin" diff --git a/runtime/queries/erlang/highlights.scm b/runtime/queries/erlang/highlights.scm index 067e0f82..1e075349 100644 --- a/runtime/queries/erlang/highlights.scm +++ b/runtime/queries/erlang/highlights.scm @@ -46,10 +46,16 @@ ]) (#eq? @keyword "define")) +(attribute + name: (atom) @keyword + (arguments + (_) @keyword.directive) + (#match? @keyword "ifn?def")) + (attribute name: (atom) @keyword module: (atom) @module - (#eq? @keyword "spec")) + (#eq? @keyword "(spec|callback)")) ; Functions (function name: (atom) @function) @@ -69,10 +75,7 @@ (record name: (atom) @type) ; Keywords -((attribute name: (atom) @keyword) - (#match? - @keyword - "^(define|export|export_type|include|include_lib|ifdef|ifndef|if|elif|else|endif|vsn|on_load|behaviour|record|file|type|opaque|spec)$")) +(attribute name: (atom) @keyword) ["case" "fun" "if" "of" "when" "end" "receive" "try" "catch" "after" "begin" "maybe"] @keyword @@ -86,10 +89,6 @@ (unary_operator operator: _ @operator) ["/" ":" "#" "->"] @operator -; Comments -((variable) @comment.discard - (#match? @comment.discard "^_")) - (tripledot) @comment.discard (comment) @comment @@ -99,12 +98,13 @@ "?"+ @keyword.directive name: (_) @keyword.directive) +; Comments +((variable) @comment.discard + (#match? @comment.discard "^_")) + ; Basic types (variable) @variable -[ - (atom) - (quoted_atom) -] @string.special.symbol +(atom) @string.special.symbol (string) @string (character) @constant.character diff --git a/runtime/queries/heex/highlights.scm b/runtime/queries/heex/highlights.scm index 301f57c8..d63853b5 100644 --- a/runtime/queries/heex/highlights.scm +++ b/runtime/queries/heex/highlights.scm @@ -11,8 +11,6 @@ "--%>" "-->" "/>" - "{" - "}" ; These could be `@keyword`s but the closing `>` wouldn't be highlighted ; as `@keyword` "<:" @@ -21,6 +19,8 @@ ; Non-comment or tag delimiters [ + "{" + "}" "<%" "<%=" "<%%="