Lua: highlight function name

This commit is contained in:
Santos Gallegos
2020-08-03 21:40:23 -05:00
committed by Thomas Vigouroux
parent 688161c174
commit 429036317a
5 changed files with 17 additions and 7 deletions

View File

@@ -124,6 +124,7 @@ are optional and will not have any effect for now.
@label for C/Lua-like labels
@operator
@keyword
function
@exception
@include keywords for including modules (e.g. import/from in Python)

View File

@@ -388,6 +388,10 @@ For any operator: `+`, but also `->` and `*` in C.
*hl-TSKeyword*
For keywords that don't fall in previous categories.
`TSKeywordFunction`
*hl-TSKeywordFunction*
For keywords used to define a fuction.
`TSException`
*hl-TSException*
For exception related keywords.

View File

@@ -46,6 +46,7 @@ hlmap["repeat"] = "TSRepeat"
hlmap["label"] = "TSLabel"
hlmap["operator"] = "TSOperator"
hlmap["keyword"] = "TSKeyword"
hlmap["keyword.function"] = "TSKeywordFunction"
hlmap["exception"] = "TSException"
hlmap["type"] = "TSType"

View File

@@ -54,6 +54,7 @@ highlight default link TSRepeat Repeat
highlight default link TSLabel Label
highlight default link TSOperator Operator
highlight default link TSKeyword Keyword
highlight default link TSKeywordFunction Keyword
highlight default link TSException Exception
highlight default link TSType Type

View File

@@ -25,11 +25,11 @@
)
[
"in"
"local"
"return"
(break_statement)
"goto"
"in"
"local"
"return"
(break_statement)
"goto"
] @keyword
;; Operators
@@ -77,9 +77,12 @@
(nil) @constant.builtin
(spread) @constant ;; "..."
;; Nodes
("function" @function "end" @function) ;; Any node that has both funtion and end in it
;; Functions
("function" @keyword.function
[(function_name) (identifier)] @function
"end" @keyword.function)
;; Nodes
(table ["{" "}"] @constructor)
(comment) @comment
(string) @string