mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-17 19:00:02 -04:00
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>
This commit is contained in:
parent
1e4c846d01
commit
a90e5f4c5f
1 changed files with 78 additions and 5 deletions
|
|
@ -2,14 +2,29 @@
|
||||||
|
|
||||||
;; variables
|
;; variables
|
||||||
|
|
||||||
(
|
(identifier) @variable
|
||||||
(identifier) @variable.builtin
|
|
||||||
(#match? @variable.builtin "^this$")
|
|
||||||
)
|
|
||||||
|
|
||||||
;; method calls
|
((identifier) @variable.builtin
|
||||||
|
(#match? @variable.builtin "^this$"))
|
||||||
|
|
||||||
|
;; 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
|
; method definition
|
||||||
|
|
||||||
(class_definition
|
(class_definition
|
||||||
body: (template_body
|
body: (template_body
|
||||||
(function_definition
|
(function_definition
|
||||||
|
|
@ -24,15 +39,52 @@
|
||||||
name: (identifier) @method)))
|
name: (identifier) @method)))
|
||||||
|
|
||||||
; method invocation
|
; method invocation
|
||||||
|
|
||||||
|
(call_expression
|
||||||
|
function: (identifier) @function)
|
||||||
|
|
||||||
(call_expression
|
(call_expression
|
||||||
function: (field_expression
|
function: (field_expression
|
||||||
field: (identifier) @method))
|
field: (identifier) @method))
|
||||||
|
|
||||||
|
(generic_function
|
||||||
|
function: (identifier) @function)
|
||||||
|
|
||||||
(
|
(
|
||||||
(identifier) @function.builtin
|
(identifier) @function.builtin
|
||||||
(#match? @function.builtin "^super$")
|
(#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
|
;; keywords
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -71,6 +123,20 @@
|
||||||
"match"
|
"match"
|
||||||
] @conditional
|
] @conditional
|
||||||
|
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
[
|
||||||
|
"."
|
||||||
|
","
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
[
|
[
|
||||||
"do"
|
"do"
|
||||||
"for"
|
"for"
|
||||||
|
|
@ -80,6 +146,11 @@
|
||||||
|
|
||||||
"def" @keyword.function
|
"def" @keyword.function
|
||||||
|
|
||||||
|
[
|
||||||
|
"=>"
|
||||||
|
"<-"
|
||||||
|
] @operator
|
||||||
|
|
||||||
"import" @include
|
"import" @include
|
||||||
|
|
||||||
[
|
[
|
||||||
|
|
@ -90,6 +161,8 @@
|
||||||
|
|
||||||
"return" @keyword.return
|
"return" @keyword.return
|
||||||
|
|
||||||
|
(comment) @comment
|
||||||
|
|
||||||
;; `case` is a conditional keyword in case_block
|
;; `case` is a conditional keyword in case_block
|
||||||
|
|
||||||
(case_block
|
(case_block
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue