aboutsummaryrefslogtreecommitdiffstats
path: root/queries/scala
diff options
context:
space:
mode:
authorPham Huy Hoang <hoangtun0810@gmail.com>2024-01-06 15:05:50 +0900
committerChristian Clason <c.clason@uni-graz.at>2024-01-19 16:58:37 +0100
commit57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 (patch)
tree70bf645539882b88e6fa129cefd30986b89bbac3 /queries/scala
parentci: add query lint job (diff)
downloadnvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.gz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.bz2
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.lz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.xz
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.zst
nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.zip
chore: query formatting
Diffstat (limited to 'queries/scala')
-rw-r--r--queries/scala/folds.scm27
-rw-r--r--queries/scala/highlights.scm157
-rw-r--r--queries/scala/injections.scm4
-rw-r--r--queries/scala/locals.scm15
4 files changed, 115 insertions, 88 deletions
diff --git a/queries/scala/folds.scm b/queries/scala/folds.scm
index e748e86df..b0f08188e 100644
--- a/queries/scala/folds.scm
+++ b/queries/scala/folds.scm
@@ -1,15 +1,16 @@
-(call_expression (block) @fold)
+(call_expression
+ (block) @fold)
-[(class_definition)
- (trait_definition)
- (object_definition)
- (function_definition)
- (val_definition)
- (import_declaration)
-
- (while_expression)
- (do_while_expression)
- (for_expression)
- (try_expression)
- (match_expression)
+[
+ (class_definition)
+ (trait_definition)
+ (object_definition)
+ (function_definition)
+ (val_definition)
+ (import_declaration)
+ (while_expression)
+ (do_while_expression)
+ (for_expression)
+ (try_expression)
+ (match_expression)
] @fold
diff --git a/queries/scala/highlights.scm b/queries/scala/highlights.scm
index 2c483c46b..e4d219f40 100644
--- a/queries/scala/highlights.scm
+++ b/queries/scala/highlights.scm
@@ -1,5 +1,4 @@
; CREDITS @stumash (stuart.mashaal@gmail.com)
-
(class_definition
name: (identifier) @type)
@@ -18,25 +17,26 @@
(simple_enum_case
name: (identifier) @type)
-;; variables
-
-(class_parameter
+; variables
+(class_parameter
name: (identifier) @variable.parameter)
-(self_type (identifier) @variable.parameter)
+(self_type
+ (identifier) @variable.parameter)
-(interpolation (identifier) @none)
-(interpolation (block) @none)
+(interpolation
+ (identifier) @none)
-;; types
+(interpolation
+ (block) @none)
+; types
(type_definition
name: (type_identifier) @type.definition)
(type_identifier) @type
-;; val/var definitions/declarations
-
+; val/var definitions/declarations
(val_definition
pattern: (identifier) @variable)
@@ -50,35 +50,46 @@
name: (identifier) @variable)
; method definition
-
(function_declaration
- name: (identifier) @function.method)
+ name: (identifier) @function.method)
(function_definition
- name: (identifier) @function.method)
+ name: (identifier) @function.method)
; imports/exports
-
(import_declaration
path: (identifier) @module)
-((stable_identifier (identifier) @module))
+
+((stable_identifier
+ (identifier) @module))
((import_declaration
- path: (identifier) @type) (#lua-match? @type "^[A-Z]"))
-((stable_identifier (identifier) @type) (#lua-match? @type "^[A-Z]"))
+ path: (identifier) @type)
+ (#lua-match? @type "^[A-Z]"))
+
+((stable_identifier
+ (identifier) @type)
+ (#lua-match? @type "^[A-Z]"))
(export_declaration
path: (identifier) @module)
-((stable_identifier (identifier) @module))
+
+((stable_identifier
+ (identifier) @module))
((export_declaration
- path: (identifier) @type) (#lua-match? @type "^[A-Z]"))
-((stable_identifier (identifier) @type) (#lua-match? @type "^[A-Z]"))
+ path: (identifier) @type)
+ (#lua-match? @type "^[A-Z]"))
-((namespace_selectors (identifier) @type) (#lua-match? @type "^[A-Z]"))
+((stable_identifier
+ (identifier) @type)
+ (#lua-match? @type "^[A-Z]"))
-; method invocation
+((namespace_selectors
+ (identifier) @type)
+ (#lua-match? @type "^[A-Z]"))
+; method invocation
(call_expression
function: (identifier) @function.call)
@@ -86,12 +97,13 @@
function: (operator_identifier) @function.call)
(call_expression
- function: (field_expression
- field: (identifier) @function.method.call))
+ function:
+ (field_expression
+ field: (identifier) @function.method.call))
((call_expression
- function: (identifier) @constructor)
- (#lua-match? @constructor "^[A-Z]"))
+ function: (identifier) @constructor)
+ (#lua-match? @constructor "^[A-Z]"))
(generic_function
function: (identifier) @function.call)
@@ -100,7 +112,6 @@
interpolator: (identifier) @function.call)
; function definitions
-
(function_definition
name: (identifier) @function)
@@ -111,20 +122,30 @@
name: (identifier) @variable.parameter)
; expressions
+(field_expression
+ field: (identifier) @property)
-(field_expression field: (identifier) @property)
-(field_expression value: (identifier) @type
- (#lua-match? @type "^[A-Z]"))
+(field_expression
+ value: (identifier) @type
+ (#lua-match? @type "^[A-Z]"))
-(infix_expression operator: (identifier) @operator)
-(infix_expression operator: (operator_identifier) @operator)
-(infix_type operator: (operator_identifier) @operator)
-(infix_type operator: (operator_identifier) @operator)
+(infix_expression
+ operator: (identifier) @operator)
-; literals
+(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) @number.float
[
@@ -135,13 +156,16 @@
(symbol_literal) @string.special.symbol
-(interpolation "$" @punctuation.special)
-
-;; keywords
+(interpolation
+ "$" @punctuation.special)
+; keywords
(opaque_modifier) @type.qualifier
+
(infix_modifier) @keyword
+
(transparent_modifier) @type.qualifier
+
(open_modifier) @type.qualifier
[
@@ -151,8 +175,8 @@
"extends"
"derives"
"finally"
-;; `forSome` existential types not implemented yet
-;; `macro` not implemented yet
+ ; `forSome` existential types not implemented yet
+ ; `macro` not implemented yet
"object"
"override"
"package"
@@ -186,8 +210,7 @@
(annotation) @attribute
-;; special keywords
-
+; special keywords
"new" @keyword.operator
[
@@ -198,17 +221,17 @@
] @keyword.conditional
[
- "("
- ")"
- "["
- "]"
- "{"
- "}"
-] @punctuation.bracket
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+] @punctuation.bracket
[
- "."
- ","
+ "."
+ ","
] @punctuation.delimiter
[
@@ -221,12 +244,15 @@
"def" @keyword.function
[
- "=>"
- "<-"
- "@"
+ "=>"
+ "<-"
+ "@"
] @operator
-["import" "export"] @keyword.import
+[
+ "import"
+ "export"
+] @keyword.import
[
"try"
@@ -244,22 +270,23 @@
((block_comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
-;; `case` is a conditional keyword in case_block
-
+; `case` is a conditional keyword in case_block
(case_block
- (case_clause ("case") @keyword.conditional))
+ (case_clause
+ ("case") @keyword.conditional))
(operator_identifier) @operator
-((identifier) @type (#lua-match? @type "^[A-Z]"))
+((identifier) @type
+ (#lua-match? @type "^[A-Z]"))
+
((identifier) @variable.builtin
- (#lua-match? @variable.builtin "^this$"))
+ (#lua-match? @variable.builtin "^this$"))
-(
- (identifier) @function.builtin
- (#lua-match? @function.builtin "^super$")
-)
+((identifier) @function.builtin
+ (#lua-match? @function.builtin "^super$"))
-;; Scala CLI using directives
+; Scala CLI using directives
(using_directive_key) @variable.parameter
+
(using_directive_value) @string
diff --git a/queries/scala/injections.scm b/queries/scala/injections.scm
index aebb54d93..1c2fe3cc9 100644
--- a/queries/scala/injections.scm
+++ b/queries/scala/injections.scm
@@ -1,5 +1,5 @@
((comment) @injection.content
- (#set! injection.language "comment"))
+ (#set! injection.language "comment"))
((block_comment) @injection.content
- (#set! injection.language "comment"))
+ (#set! injection.language "comment"))
diff --git a/queries/scala/locals.scm b/queries/scala/locals.scm
index 689b140b3..ec205c4e1 100644
--- a/queries/scala/locals.scm
+++ b/queries/scala/locals.scm
@@ -1,5 +1,4 @@
; Scopes
-
[
(template_body)
(lambda_expression)
@@ -9,16 +8,15 @@
] @local.scope
; References
-
(identifier) @local.reference
; Definitions
-
(function_declaration
name: (identifier) @local.definition.function)
(function_definition
- name: ((identifier) @local.definition.function)
+ name:
+ ((identifier) @local.definition.function)
(#set! definition.var.scope parent))
(parameter
@@ -46,7 +44,8 @@
name: (identifier) @local.definition.var)
(for_expression
- enumerators: (enumerators
- (enumerator
- (tuple_pattern
- (identifier) @local.definition.var))))
+ enumerators:
+ (enumerators
+ (enumerator
+ (tuple_pattern
+ (identifier) @local.definition.var))))