aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCorey Williamson <euclidianAce@protonmail.com>2021-03-23 16:06:02 -0500
committerStephan Seitz <stephan.lauf@yahoo.de>2021-03-23 22:20:30 +0100
commit548a0d8d7ff1bda7f57170c6ca383544204b0e8c (patch)
treea969d8b4847e174d759d9a888a56d1c4b9c4fc28
parent[docgen] Update README.md (diff)
downloadnvim-treesitter-548a0d8d7ff1bda7f57170c6ca383544204b0e8c.tar
nvim-treesitter-548a0d8d7ff1bda7f57170c6ca383544204b0e8c.tar.gz
nvim-treesitter-548a0d8d7ff1bda7f57170c6ca383544204b0e8c.tar.bz2
nvim-treesitter-548a0d8d7ff1bda7f57170c6ca383544204b0e8c.tar.lz
nvim-treesitter-548a0d8d7ff1bda7f57170c6ca383544204b0e8c.tar.xz
nvim-treesitter-548a0d8d7ff1bda7f57170c6ca383544204b0e8c.tar.zst
nvim-treesitter-548a0d8d7ff1bda7f57170c6ca383544204b0e8c.zip
Update teal highlights
-rw-r--r--lua/nvim-treesitter/parsers.lua1
-rw-r--r--queries/teal/folds.scm4
-rw-r--r--queries/teal/highlights.scm58
3 files changed, 44 insertions, 19 deletions
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index efbe1f879..ac5c80d6f 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -385,7 +385,6 @@ list.teal = {
install_info = {
url = "https://github.com/euclidianAce/tree-sitter-teal",
files = { "src/parser.c", "src/scanner.c" },
- requires_generate_from_grammar = true,
},
maintainers = {'@euclidianAce'},
}
diff --git a/queries/teal/folds.scm b/queries/teal/folds.scm
index c6d6a51dd..8820a67fa 100644
--- a/queries/teal/folds.scm
+++ b/queries/teal/folds.scm
@@ -10,3 +10,7 @@
(anon_function)
(table_constructor)
] @fold
+
+(record_body
+ (record_entry
+ value: (record_body)) @fold)
diff --git a/queries/teal/highlights.scm b/queries/teal/highlights.scm
index 0556004fb..535a49cdf 100644
--- a/queries/teal/highlights.scm
+++ b/queries/teal/highlights.scm
@@ -1,4 +1,21 @@
+;; Primitives
+(boolean) @boolean
+(comment) @comment
+(shebang_comment) @comment
+(identifier) @variable
+((identifier) @variable.builtin
+ (#eq? @variable.builtin "self"))
+(nil) @constant.builtin
+(number) @number
+(string) @string
+(table_constructor ["{" "}"] @constructor)
+(varargs "..." @constant.builtin)
+[ "," "." ":" ";" ] @punctuation.delimiter
+
+(escape_sequence) @string.escape
+(format_specifier) @string.escape
+
;; Basic statements/Keywords
[ "if" "then" "elseif" "else" ] @conditional
[ "for" "while" "repeat" "until" ] @repeat
@@ -13,12 +30,9 @@
(enum_declaration "global" @keyword)
;; Ops
-[ "not" "and" "or" "as" "is" ] @keyword.operator
-
-[ "=" "~=" "==" "<=" ">=" "<" ">"
-"+" "-" "%" "/" "//" "*" "^"
-"&" "~" "|" ">>" "<<"
-".." "#" ] @operator
+(bin_op (op) @operator)
+(unary_op (op) @operator)
+[ "=" "as" ] @operator
;; Functions
(function_statement
@@ -86,17 +100,25 @@
. attribute: (attribute) @attribute
. ">" @punctuation.bracket))
[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
-(boolean) @boolean
-(comment) @comment
-(shebang_comment) @comment
-(identifier) @variable
-((identifier) @variable.builtin
- (#eq? @variable.builtin "self"))
-(nil) @constant.builtin
-(number) @number
-(string) @string
-(table_constructor ["{" "}"] @constructor)
-(varargs "..." @constant.builtin)
-[ "," "." ":" ";" ] @punctuation.delimiter
+
+;; Only highlight format specifiers in calls to string.format
+;; string.format('...')
+;(function_call
+; called_object: (index
+; (identifier) @base
+; key: (identifier) @entry)
+; arguments: (arguments .
+; (string (format_specifier) @string.escape))
+;
+; (#eq? @base "string")
+; (#eq? @entry "format"))
+
+;; ('...'):format()
+;(function_call
+; called_object: (method_index
+; (string (format_specifier) @string.escape)
+; key: (identifier) @func-name)
+; (#eq? @func-name "format"))
+
(ERROR) @error