summaryrefslogtreecommitdiff
path: root/runtime/queries/julia
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-09-07 04:05:53 +0000
committerBlaž Hrastnik2021-09-07 04:05:53 +0000
commitfd36fbdebfa6508699979dc426725cbbc2dbe295 (patch)
treed1e38ef912228993ff029fce58898aefce295079 /runtime/queries/julia
parentfde0a84bbacd2b95ef5f6433f8ee8d4a91817555 (diff)
parent3cbdc057de69b3ffaf1e8b69dea114872d9d128a (diff)
Merge branch 'lsp-async-init'
Diffstat (limited to 'runtime/queries/julia')
-rw-r--r--runtime/queries/julia/highlights.scm82
1 files changed, 43 insertions, 39 deletions
diff --git a/runtime/queries/julia/highlights.scm b/runtime/queries/julia/highlights.scm
index a53dabe5..7b7d426c 100644
--- a/runtime/queries/julia/highlights.scm
+++ b/runtime/queries/julia/highlights.scm
@@ -1,9 +1,3 @@
-(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_]*$"))
[
(triple_string)
@@ -28,43 +22,43 @@
(call_expression
(identifier) @function)
(call_expression
- (field_expression (identifier) @method .))
+ (field_expression (identifier) @function.method .))
(broadcast_call_expression
(identifier) @function)
(broadcast_call_expression
- (field_expression (identifier) @method .))
+ (field_expression (identifier) @function.method .))
(parameter_list
- (identifier) @parameter)
+ (identifier) @variable.parameter)
(parameter_list
(optional_parameter .
- (identifier) @parameter))
+ (identifier) @variable.parameter))
(typed_parameter
- (identifier) @parameter
+ (identifier) @variable.parameter
(identifier) @type)
(type_parameter_list
(identifier) @type)
(typed_parameter
- (identifier) @parameter
+ (identifier) @variable.parameter
(parameterized_identifier) @type)
(function_expression
- . (identifier) @parameter)
-(spread_parameter) @parameter
+ . (identifier) @variable.parameter)
+(spread_parameter) @variable.parameter
(spread_parameter
- (identifier) @parameter)
+ (identifier) @variable.parameter)
(named_argument
- . (identifier) @parameter)
+ . (identifier) @variable.parameter)
(argument_list
(typed_expression
- (identifier) @parameter
+ (identifier) @variable.parameter
(identifier) @type))
(argument_list
(typed_expression
- (identifier) @parameter
+ (identifier) @variable.parameter
(parameterized_identifier) @type))
;; Symbol expressions (:my-wanna-be-lisp-keyword)
(quote_expression
- (identifier)) @symbol
+ (identifier)) @string.special.symbol
;; Parsing error! foo (::Type) get's parsed as two quote expressions
(argument_list
@@ -76,7 +70,7 @@
(identifier) @type)
(parameterized_identifier (_)) @type
(argument_list
- (typed_expression . (identifier) @parameter))
+ (typed_expression . (identifier) @variable.parameter))
(typed_expression
(identifier) @type .)
@@ -113,13 +107,13 @@
"end" @keyword
(if_statement
- ["if" "end"] @conditional)
+ ["if" "end"] @keyword.control.conditional)
(elseif_clause
- ["elseif"] @conditional)
+ ["elseif"] @keyword.control.conditional)
(else_clause
- ["else"] @conditional)
+ ["else"] @keyword.control.conditional)
(ternary_expression
- ["?" ":"] @conditional)
+ ["?" ":"] @keyword.control.conditional)
(function_definition ["function" "end"] @keyword.function)
@@ -134,47 +128,57 @@
"type"
] @keyword
-((identifier) @keyword (#any-of? @keyword "global" "local"))
+((identifier) @keyword (match? @keyword "global|local"))
(compound_expression
["begin" "end"] @keyword)
(try_statement
- ["try" "end" ] @exception)
+ ["try" "end" ] @keyword.control.exception)
(finally_clause
- "finally" @exception)
+ "finally" @keyword.control.exception)
(catch_clause
- "catch" @exception)
+ "catch" @keyword.control.exception)
(quote_statement
["quote" "end"] @keyword)
(let_statement
["let" "end"] @keyword)
(for_statement
- ["for" "end"] @repeat)
+ ["for" "end"] @keyword.control.repeat)
(while_statement
- ["while" "end"] @repeat)
-(break_statement) @repeat
-(continue_statement) @repeat
+ ["while" "end"] @keyword.control.repeat)
+(break_statement) @keyword.control.repeat
+(continue_statement) @keyword.control.repeat
(for_binding
- "in" @repeat)
+ "in" @keyword.control.repeat)
(for_clause
- "for" @repeat)
+ "for" @keyword.control.repeat)
(do_clause
["do" "end"] @keyword)
(export_statement
- ["export"] @include)
+ ["export"] @keyword.control.import)
[
"using"
"module"
"import"
-] @include
+] @keyword.control.import
-((identifier) @include (#eq? @include "baremodule"))
+((identifier) @keyword.control.import (#eq? @keyword.control.import "baremodule"))
(((identifier) @constant.builtin) (match? @constant.builtin "^(nothing|Inf|NaN)$"))
-(((identifier) @boolean) (eq? @boolean "true"))
-(((identifier) @boolean) (eq? @boolean "false"))
+(((identifier) @constant.builtin.boolean) (#eq? @constant.builtin.boolean "true"))
+(((identifier) @constant.builtin.boolean) (#eq? @constant.builtin.boolean "false"))
+
["::" ":" "." "," "..." "!"] @punctuation.delimiter
["[" "]" "(" ")" "{" "}"] @punctuation.bracket
+
+["="] @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_]*$"))