aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStevan Milic <stevan.milic@yahoo.com>2021-08-28 21:07:44 +0200
committerStephan Seitz <stephan.seitz@fau.de>2021-09-17 21:06:36 +0200
commit1e7436ca37776a4c1db083fe114169a4931505c2 (patch)
treea0ae8a248f52e14d4f74fee49cca1fc3de7555ff
parenthighlights(php): add missings operators `?->` and `=>` (#1729) (diff)
downloadnvim-treesitter-1e7436ca37776a4c1db083fe114169a4931505c2.tar
nvim-treesitter-1e7436ca37776a4c1db083fe114169a4931505c2.tar.gz
nvim-treesitter-1e7436ca37776a4c1db083fe114169a4931505c2.tar.bz2
nvim-treesitter-1e7436ca37776a4c1db083fe114169a4931505c2.tar.lz
nvim-treesitter-1e7436ca37776a4c1db083fe114169a4931505c2.tar.xz
nvim-treesitter-1e7436ca37776a4c1db083fe114169a4931505c2.tar.zst
nvim-treesitter-1e7436ca37776a4c1db083fe114169a4931505c2.zip
update scala highlights (#1760)
* add type highlights * add call expression highlights * add function definition highlights * add expression highlights * add literals highlights * add operator highlights * add punctuation highlights * add comment highlights Co-authored-by: Stevan Milic <stevan.milic@tradecore.com>
-rw-r--r--queries/scala/highlights.scm83
1 files changed, 78 insertions, 5 deletions
diff --git a/queries/scala/highlights.scm b/queries/scala/highlights.scm
index aecbdf487..544780857 100644
--- a/queries/scala/highlights.scm
+++ b/queries/scala/highlights.scm
@@ -2,14 +2,29 @@
;; variables
-(
- (identifier) @variable.builtin
- (#match? @variable.builtin "^this$")
-)
+(identifier) @variable
+
+((identifier) @variable.builtin
+ (#match? @variable.builtin "^this$"))
-;; method calls
+;; types
+
+(type_identifier) @type
+
+(class_definition
+ name: (identifier) @type)
+
+(object_definition
+ name: (identifier) @type)
+
+(trait_definition
+ name: (identifier) @type)
+
+(type_definition
+ name: (type_identifier) @type)
; method definition
+
(class_definition
body: (template_body
(function_definition
@@ -24,15 +39,52 @@
name: (identifier) @method)))
; method invocation
+
+(call_expression
+ function: (identifier) @function)
+
(call_expression
function: (field_expression
field: (identifier) @method))
+(generic_function
+ function: (identifier) @function)
+
(
(identifier) @function.builtin
(#match? @function.builtin "^super$")
)
+; function definitions
+
+(function_definition
+ name: (identifier) @function)
+
+(parameter
+ name: (identifier) @parameter)
+
+; expressions
+
+(field_expression field: (identifier) @property)
+
+(infix_expression operator: (identifier) @operator)
+(infix_expression operator: (operator_identifier) @operator)
+(infix_type operator: (operator_identifier) @operator)
+(infix_type operator: (operator_identifier) @operator)
+
+; literals
+
+(boolean_literal) @boolean
+(integer_literal) @number
+(floating_point_literal) @float
+(string) @string
+
+[
+(symbol_literal)
+(string)
+(character_literal)
+] @string
+
;; keywords
[
@@ -72,6 +124,20 @@
] @conditional
[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
+
+[
+ "."
+ ","
+] @punctuation.delimiter
+
+[
"do"
"for"
"while"
@@ -80,6 +146,11 @@
"def" @keyword.function
+[
+ "=>"
+ "<-"
+] @operator
+
"import" @include
[
@@ -90,6 +161,8 @@
"return" @keyword.return
+(comment) @comment
+
;; `case` is a conditional keyword in case_block
(case_block