Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/queries/scala/highlights.scm')
-rw-r--r--runtime/queries/scala/highlights.scm154
1 files changed, 45 insertions, 109 deletions
diff --git a/runtime/queries/scala/highlights.scm b/runtime/queries/scala/highlights.scm
index 5e5d63e4..50a6e18a 100644
--- a/runtime/queries/scala/highlights.scm
+++ b/runtime/queries/scala/highlights.scm
@@ -2,9 +2,6 @@
;; variables
-(identifier) @variable
-
-(operator_identifier) @operator
((identifier) @variable.builtin
(#match? @variable.builtin "^this$"))
@@ -36,35 +33,22 @@
(type_definition
name: (type_identifier) @type)
-(full_enum_case
- name: (identifier) @type)
-
-(simple_enum_case
- name: (identifier) @type)
-
-;; val/var definitions/declarations
-
-(val_definition
- pattern: (identifier) @variable)
-
-(var_definition
- pattern: (identifier) @variable)
+; method definition
-(val_declaration
- name: (identifier) @variable)
-
-(var_declaration
- name: (identifier) @variable)
-
-; function definitions/declarations
-
-(function_declaration
- name: (identifier) @function.method)
-
-(function_definition
- name: (identifier) @function.method)
+(class_definition
+ body: (template_body
+ (function_definition
+ name: (identifier) @function.method)))
+(object_definition
+ body: (template_body
+ (function_definition
+ name: (identifier) @function.method)))
+(trait_definition
+ body: (template_body
+ (function_definition
+ name: (identifier) @function.method)))
-; imports/exports
+; imports
(import_declaration
path: (identifier) @namespace)
@@ -74,15 +58,7 @@
path: (identifier) @type) (#match? @type "^[A-Z]"))
((stable_identifier (identifier) @type) (#match? @type "^[A-Z]"))
-(export_declaration
- path: (identifier) @namespace)
-((stable_identifier (identifier) @namespace))
-
-((export_declaration
- path: (identifier) @type) (#match? @type "^[A-Z]"))
-((stable_identifier (identifier) @type) (#match? @type "^[A-Z]"))
-
-((namespace_selectors (identifier) @type) (#match? @type "^[A-Z]"))
+((import_selectors (identifier) @type) (#match? @type "^[A-Z]"))
; method invocation
@@ -91,16 +67,9 @@
function: (identifier) @function)
(call_expression
- function: (operator_identifier) @function)
-
-(call_expression
function: (field_expression
field: (identifier) @function.method))
-(call_expression
- function: (field_expression
- field: (operator_identifier) @function.method))
-
((call_expression
function: (identifier) @variable.other.member)
(#match? @variable.other.member "^[A-Z]"))
@@ -108,9 +77,6 @@
(generic_function
function: (identifier) @function)
-(interpolated_string_expression
- interpolator: (identifier) @function)
-
(
(identifier) @function.builtin
(#match? @function.builtin "^super$")
@@ -121,15 +87,9 @@
(function_definition
name: (identifier) @function)
-(function_definition
- name: (operator_identifier) @function)
-
(parameter
name: (identifier) @variable.parameter)
-(binding
- name: (identifier) @variable.parameter)
-
; expressions
@@ -149,7 +109,7 @@
(symbol_literal) @string.special.symbol
-
+
[
(string)
(character_literal)
@@ -158,50 +118,29 @@
(interpolation "$" @punctuation.special)
-; annotations
-
-(annotation) @attribute
-
;; keywords
-;; storage in TextMate scope lingo means field or type
[
- (opaque_modifier)
- (infix_modifier)
- (transparent_modifier)
- (open_modifier)
"abstract"
+ "case"
+ "class"
+ "extends"
"final"
+ "finally"
+;; `forSome` existential types not implemented yet
"implicit"
"lazy"
+;; `macro` not implemented yet
+ "object"
"override"
+ "package"
"private"
"protected"
"sealed"
-] @keyword.storage.modifier
-
-[
- "class"
- "enum"
- "extension"
- "given"
- "object"
- "package"
"trait"
"type"
"val"
"var"
-] @keyword.storage.type
-
-[
- "as"
- "derives"
- "end"
- "extends"
-;; `forSome` existential types not implemented yet
-;; `macro` not implemented yet
-;; `throws`
- "using"
"with"
] @keyword
@@ -213,36 +152,33 @@
"new" @keyword.operator
[
- "case"
- "catch"
- "else"
- "finally"
- "if"
- "match"
- "then"
- "throw"
- "try"
+ "else"
+ "if"
+ "match"
+ "try"
+ "catch"
+ "throw"
] @keyword.control.conditional
[
- "("
- ")"
- "["
- "]"
- "{"
- "}"
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
] @punctuation.bracket
[
- "."
- ","
+ "."
+ ","
] @punctuation.delimiter
[
- "do"
- "for"
- "while"
- "yield"
+ "do"
+ "for"
+ "while"
+ "yield"
] @keyword.control.repeat
"def" @keyword.function
@@ -255,13 +191,13 @@
"import" @keyword.control.import
-"export" @keyword.control.import
-
"return" @keyword.control.return
-[(comment) (block_comment)] @comment
+(comment) @comment
;; `case` is a conditional keyword in case_block
(case_block
(case_clause ("case") @keyword.control.conditional))
+
+(identifier) @variable \ No newline at end of file