helix-mods/runtime/queries/julia/highlights.scm

185 lines
4.6 KiB
Scheme
Raw Normal View History

2021-07-04 14:24:33 +02:00
[
(triple_string)
(string)
] @string
(string
prefix: (identifier) @constant.builtin)
(macro_identifier) @function.macro
(macro_identifier (identifier) @function.macro) ; for any one using the variable highlight
(macro_definition
name: (identifier) @function.macro
["macro" "end" @keyword])
(field_expression
(identifier)
(identifier) @variable.other.member .)
2021-07-04 14:24:33 +02:00
(function_definition
name: (identifier) @function)
(call_expression
(identifier) @function)
(call_expression
2021-09-02 07:58:57 +02:00
(field_expression (identifier) @function.method .))
2021-07-04 14:24:33 +02:00
(broadcast_call_expression
(identifier) @function)
(broadcast_call_expression
2021-09-02 07:58:57 +02:00
(field_expression (identifier) @function.method .))
2021-07-04 14:24:33 +02:00
(parameter_list
2021-09-02 07:58:57 +02:00
(identifier) @variable.parameter)
2021-07-04 14:24:33 +02:00
(parameter_list
(optional_parameter .
2021-09-02 07:58:57 +02:00
(identifier) @variable.parameter))
2021-07-04 14:24:33 +02:00
(typed_parameter
2021-09-02 07:58:57 +02:00
(identifier) @variable.parameter
2021-07-04 14:24:33 +02:00
(identifier) @type)
(type_parameter_list
(identifier) @type)
(typed_parameter
2021-09-02 07:58:57 +02:00
(identifier) @variable.parameter
2021-07-04 14:24:33 +02:00
(parameterized_identifier) @type)
(function_expression
2021-09-02 07:58:57 +02:00
. (identifier) @variable.parameter)
(spread_parameter) @variable.parameter
2021-07-04 14:24:33 +02:00
(spread_parameter
2021-09-02 07:58:57 +02:00
(identifier) @variable.parameter)
2021-07-04 14:24:33 +02:00
(named_argument
2021-09-02 07:58:57 +02:00
. (identifier) @variable.parameter)
2021-07-04 14:24:33 +02:00
(argument_list
(typed_expression
2021-09-02 07:58:57 +02:00
(identifier) @variable.parameter
2021-07-04 14:24:33 +02:00
(identifier) @type))
(argument_list
(typed_expression
2021-09-02 07:58:57 +02:00
(identifier) @variable.parameter
2021-07-04 14:24:33 +02:00
(parameterized_identifier) @type))
;; Symbol expressions (:my-wanna-be-lisp-keyword)
(quote_expression
2021-09-02 07:58:57 +02:00
(identifier)) @string.special.symbol
2021-07-04 14:24:33 +02:00
;; Parsing error! foo (::Type) get's parsed as two quote expressions
(argument_list
(quote_expression
(quote_expression
(identifier) @type)))
(type_argument_list
(identifier) @type)
(parameterized_identifier (_)) @type
(argument_list
2021-09-02 07:58:57 +02:00
(typed_expression . (identifier) @variable.parameter))
2021-07-04 14:24:33 +02:00
(typed_expression
(identifier) @type .)
(typed_expression
(parameterized_identifier) @type .)
(struct_definition
name: (identifier) @type)
(number) @constant.numeric.integer
2021-07-04 14:24:33 +02:00
(range_expression
(identifier) @constant.numeric.integer
(eq? @constant.numeric.integer "end"))
2021-07-04 14:24:33 +02:00
(range_expression
(_
(identifier) @constant.numeric.integer
(eq? @constant.numeric.integer "end")))
2021-07-04 14:24:33 +02:00
(coefficient_expression
(number)
(identifier) @constant.builtin)
;; TODO: operators.
;; Those are a bit difficult to implement since the respective nodes are hidden right now (_power_operator)
;; and heavily use Unicode chars (support for those are bad in vim/lua regexes)
;[;
;(power_operator);
;(times_operator);
;(plus_operator);
;(arrow_operator);
;(comparison_operator);
;(assign_operator);
;] @operator ;
"end" @keyword
(if_statement
2021-09-02 07:58:57 +02:00
["if" "end"] @keyword.control.conditional)
2021-07-04 14:24:33 +02:00
(elseif_clause
2021-09-02 07:58:57 +02:00
["elseif"] @keyword.control.conditional)
2021-07-04 14:24:33 +02:00
(else_clause
2021-09-02 07:58:57 +02:00
["else"] @keyword.control.conditional)
2021-07-04 14:24:33 +02:00
(ternary_expression
2021-09-02 07:58:57 +02:00
["?" ":"] @keyword.control.conditional)
2021-07-04 14:24:33 +02:00
(function_definition ["function" "end"] @keyword.function)
(comment) @comment
[
"const"
"return"
"macro"
"struct"
"primitive"
"type"
] @keyword
2021-09-02 07:58:57 +02:00
((identifier) @keyword (match? @keyword "global|local"))
2021-07-04 14:24:33 +02:00
(compound_expression
["begin" "end"] @keyword)
(try_statement
2021-09-02 07:58:57 +02:00
["try" "end" ] @keyword.control.exception)
2021-07-04 14:24:33 +02:00
(finally_clause
2021-09-02 07:58:57 +02:00
"finally" @keyword.control.exception)
2021-07-04 14:24:33 +02:00
(catch_clause
2021-09-02 07:58:57 +02:00
"catch" @keyword.control.exception)
2021-07-04 14:24:33 +02:00
(quote_statement
["quote" "end"] @keyword)
(let_statement
["let" "end"] @keyword)
(for_statement
2021-09-02 07:58:57 +02:00
["for" "end"] @keyword.control.repeat)
2021-07-04 14:24:33 +02:00
(while_statement
2021-09-02 07:58:57 +02:00
["while" "end"] @keyword.control.repeat)
(break_statement) @keyword.control.repeat
(continue_statement) @keyword.control.repeat
2021-07-04 14:24:33 +02:00
(for_binding
2021-09-02 07:58:57 +02:00
"in" @keyword.control.repeat)
2021-07-04 14:24:33 +02:00
(for_clause
2021-09-02 07:58:57 +02:00
"for" @keyword.control.repeat)
2021-07-04 14:24:33 +02:00
(do_clause
["do" "end"] @keyword)
(export_statement
2021-09-02 07:58:57 +02:00
["export"] @keyword.control.import)
2021-07-04 14:24:33 +02:00
[
"using"
"module"
"import"
2021-09-02 07:58:57 +02:00
] @keyword.control.import
2021-07-04 14:24:33 +02:00
2021-09-02 07:58:57 +02:00
((identifier) @keyword.control.import (#eq? @keyword.control.import "baremodule"))
2021-07-04 14:24:33 +02:00
(((identifier) @constant.builtin) (match? @constant.builtin "^(nothing|Inf|NaN)$"))
2021-09-02 07:58:57 +02:00
(((identifier) @constant.builtin.boolean) (#eq? @constant.builtin.boolean "true"))
(((identifier) @constant.builtin.boolean) (#eq? @constant.builtin.boolean "false"))
2021-07-04 14:24:33 +02:00
["::" ":" "." "," "..." "!"] @punctuation.delimiter
["[" "]" "(" ")" "{" "}"] @punctuation.bracket
2021-09-02 07:58:57 +02:00
["="] @operator
(identifier) @variable
;; In case you want type highlighting based on Julia naming conventions (this might collide with mathematical notation)
;((identifier) @type ; exception: mark `A_foo` sort of identifiers as variables
;(match? @type "^[A-Z][^_]"))
((identifier) @constant
(match? @constant "^[A-Z][A-Z_]{2}[A-Z_]*$"))