mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-13 00:40:06 -04:00
feat(highlights/julia): make operators visible
See tree-sitter/tree-sitter-julia#34
This commit is contained in:
parent
5e24e8d6a7
commit
6a4eb4e1c3
1 changed files with 13 additions and 23 deletions
|
|
@ -1,4 +1,9 @@
|
||||||
(identifier) @variable
|
(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)
|
;; 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
|
;((identifier) @type ; exception: mark `A_foo` sort of identifiers as variables
|
||||||
;(match? @type "^[A-Z][^_]"))
|
;(match? @type "^[A-Z][^_]"))
|
||||||
|
|
@ -80,25 +85,11 @@
|
||||||
(struct_definition
|
(struct_definition
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
(range_expression
|
(subscript_expression
|
||||||
(identifier) @number
|
(_)
|
||||||
(#eq? @number "end"))
|
(range_expression
|
||||||
(range_expression
|
(identifier) @constant.builtin .)
|
||||||
(_
|
(#eq? @constant.builtin "end"))
|
||||||
(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 ;
|
|
||||||
|
|
||||||
"end" @keyword
|
"end" @keyword
|
||||||
|
|
||||||
|
|
@ -144,13 +135,13 @@
|
||||||
["while" "end"] @repeat)
|
["while" "end"] @repeat)
|
||||||
(break_statement) @repeat
|
(break_statement) @repeat
|
||||||
(continue_statement) @repeat
|
(continue_statement) @repeat
|
||||||
(for_binding
|
|
||||||
"in" @repeat)
|
|
||||||
(for_clause
|
(for_clause
|
||||||
"for" @repeat)
|
"for" @repeat)
|
||||||
(do_clause
|
(do_clause
|
||||||
["do" "end"] @keyword)
|
["do" "end"] @keyword)
|
||||||
|
|
||||||
|
"in" @keyword.operator
|
||||||
|
|
||||||
(export_statement
|
(export_statement
|
||||||
["export"] @include)
|
["export"] @include)
|
||||||
|
|
||||||
|
|
@ -196,7 +187,6 @@
|
||||||
|
|
||||||
;;; Punctuation
|
;;; Punctuation
|
||||||
|
|
||||||
(range_expression ":" @operator)
|
|
||||||
(quote_expression ":" @symbol)
|
(quote_expression ":" @symbol)
|
||||||
["::" "." "," "..." "!"] @punctuation.delimiter
|
["::" "." "," "..."] @punctuation.delimiter
|
||||||
["[" "]" "(" ")" "{" "}"] @punctuation.bracket
|
["[" "]" "(" ")" "{" "}"] @punctuation.bracket
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue