aboutsummaryrefslogtreecommitdiffstats
path: root/queries/julia
diff options
context:
space:
mode:
authorSergio Alejandro Vargas <savargasqu+git@unal.edu.co>2022-05-24 13:12:29 -0500
committerChristian Clason <christian.clason@uni-due.de>2022-06-01 09:26:50 +0200
commit6a4eb4e1c3b70bc0c0af9e3ffc52269d9be5e29c (patch)
tree4233270c85097d17c011164e417cf79f99cf9202 /queries/julia
parentUpdate lockfile.json (diff)
downloadnvim-treesitter-6a4eb4e1c3b70bc0c0af9e3ffc52269d9be5e29c.tar
nvim-treesitter-6a4eb4e1c3b70bc0c0af9e3ffc52269d9be5e29c.tar.gz
nvim-treesitter-6a4eb4e1c3b70bc0c0af9e3ffc52269d9be5e29c.tar.bz2
nvim-treesitter-6a4eb4e1c3b70bc0c0af9e3ffc52269d9be5e29c.tar.lz
nvim-treesitter-6a4eb4e1c3b70bc0c0af9e3ffc52269d9be5e29c.tar.xz
nvim-treesitter-6a4eb4e1c3b70bc0c0af9e3ffc52269d9be5e29c.tar.zst
nvim-treesitter-6a4eb4e1c3b70bc0c0af9e3ffc52269d9be5e29c.zip
feat(highlights/julia): make operators visible
See tree-sitter/tree-sitter-julia#34
Diffstat (limited to 'queries/julia')
-rw-r--r--queries/julia/highlights.scm36
1 files changed, 13 insertions, 23 deletions
diff --git a/queries/julia/highlights.scm b/queries/julia/highlights.scm
index 12c159bc3..1bf0a90e8 100644
--- a/queries/julia/highlights.scm
+++ b/queries/julia/highlights.scm
@@ -1,4 +1,9 @@
(identifier) @variable
+
+(operator) @operator
+(range_expression ":" @operator)
+(pair_expression "=>" @operator)
+
;; 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][^_]"))
@@ -80,25 +85,11 @@
(struct_definition
name: (identifier) @type)
-(range_expression
- (identifier) @number
- (#eq? @number "end"))
-(range_expression
- (_
- (identifier) @number
- (#eq? @number "end")))
-
-;; 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 ;
+(subscript_expression
+ (_)
+ (range_expression
+ (identifier) @constant.builtin .)
+ (#eq? @constant.builtin "end"))
"end" @keyword
@@ -144,13 +135,13 @@
["while" "end"] @repeat)
(break_statement) @repeat
(continue_statement) @repeat
-(for_binding
- "in" @repeat)
(for_clause
"for" @repeat)
(do_clause
["do" "end"] @keyword)
+"in" @keyword.operator
+
(export_statement
["export"] @include)
@@ -196,7 +187,6 @@
;;; Punctuation
-(range_expression ":" @operator)
(quote_expression ":" @symbol)
-["::" "." "," "..." "!"] @punctuation.delimiter
+["::" "." "," "..."] @punctuation.delimiter
["[" "]" "(" ")" "{" "}"] @punctuation.bracket