diff options
author | Indrajith K L | 2022-12-03 17:00:20 +0530 |
---|---|---|
committer | Indrajith K L | 2022-12-03 17:00:20 +0530 |
commit | f5c4671bfbad96bf346bd7e9a21fc4317b4959df (patch) | |
tree | 2764fc62da58f2ba8da7ed341643fc359873142f /helix-22.03-x86_64-windows/runtime/queries/lua | |
download | cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.tar.gz cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.tar.bz2 cli-tools-windows-f5c4671bfbad96bf346bd7e9a21fc4317b4959df.zip |
Diffstat (limited to 'helix-22.03-x86_64-windows/runtime/queries/lua')
3 files changed, 192 insertions, 0 deletions
diff --git a/helix-22.03-x86_64-windows/runtime/queries/lua/highlights.scm b/helix-22.03-x86_64-windows/runtime/queries/lua/highlights.scm new file mode 100644 index 0000000..e73b32d --- /dev/null +++ b/helix-22.03-x86_64-windows/runtime/queries/lua/highlights.scm @@ -0,0 +1,166 @@ +;;; Highlighting for lua + +;;; Builtins +(self) @variable.builtin + +;; Keywords + +(if_statement +[ + "if" + "then" + "end" +] @keyword.control.conditional) + +[ + "else" + "elseif" + "then" +] @keyword.control.conditional + +(for_statement +[ + "for" + "do" + "end" +] @keyword.control.repeat) + +(for_in_statement +[ + "for" + "do" + "end" +] @keyword.control.repeat) + +(while_statement +[ + "while" + "do" + "end" +] @keyword.control.repeat) + +(repeat_statement +[ + "repeat" + "until" +] @keyword.control.repeat) + +(do_statement +[ + "do" + "end" +] @keyword) + +[ + "in" + "local" + (break_statement) + "goto" + "return" +] @keyword + +;; Operators + +[ + "not" + "and" + "or" +] @operator + +[ +"=" +"~=" +"==" +"<=" +">=" +"<" +">" +"+" +"-" +"%" +"/" +"//" +"*" +"^" +"&" +"~" +"|" +">>" +"<<" +".." +"#" + ] @operator + +;; Punctuation +["," "." ":" ";"] @punctuation.delimiter + +;; Brackets +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + +; ;; Constants +[ +(false) +(true) +] @constant.builtin.boolean +(nil) @constant.builtin +(spread) @constant ;; "..." +((identifier) @constant + (#match? @constant "^[A-Z][A-Z_0-9]*$")) + +;; Parameters +(parameters + (identifier) @variable.parameter) + +; ;; Functions +(function [(function_name) (identifier)] @function) +(function ["function" "end"] @keyword.function) + +(function + (function_name + (function_name_field + (property_identifier) @function .))) + +(local_function (identifier) @function) +(local_function ["function" "end"] @keyword.function) + +(variable_declaration + (variable_declarator (identifier) @function) (function_definition)) +(local_variable_declaration + (variable_declarator (identifier) @function) (function_definition)) + +(function_definition ["function" "end"] @keyword.function) + +(function_call + [ + ((identifier) @variable (method) @function.method) + ((_) (method) @function.method) + (identifier) @function + (field_expression (property_identifier) @function) + ] + . (arguments)) + +;; Nodes +(table ["{" "}"] @constructor) +(comment) @comment +(string) @string +(number) @constant.numeric.integer +(label_statement) @label +; A bit of a tricky one, this will only match field names +(field . (identifier) @variable.other.member (_)) +(shebang) @comment + +;; Property +(property_identifier) @variable.other.member + +;; Variable +(identifier) @variable + +;; Error +(ERROR) @error diff --git a/helix-22.03-x86_64-windows/runtime/queries/lua/indents.toml b/helix-22.03-x86_64-windows/runtime/queries/lua/indents.toml new file mode 100644 index 0000000..df1a975 --- /dev/null +++ b/helix-22.03-x86_64-windows/runtime/queries/lua/indents.toml @@ -0,0 +1,24 @@ +indent = [ + "function_definition", + "variable_declaration", + "local_variable_declaration", + "field", + "local_function", + "function", + "if_statement", + "for_statement", + "for_in_statement", + "repeat_statement", + "return_statement", + "while_statement", + "table", + "arguments", + "do_statement", +] + +oudent = [ + "end", + "until", + "}", + ")", +] diff --git a/helix-22.03-x86_64-windows/runtime/queries/lua/injections.scm b/helix-22.03-x86_64-windows/runtime/queries/lua/injections.scm new file mode 100644 index 0000000..321c90a --- /dev/null +++ b/helix-22.03-x86_64-windows/runtime/queries/lua/injections.scm @@ -0,0 +1,2 @@ +((comment) @injection.content + (#set! injection.language "comment")) |