mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
feat(kotlin): include a folds and a locals query
This commit is contained in:
parent
886ae5b87e
commit
2a50ac94bb
2 changed files with 100 additions and 0 deletions
17
queries/kotlin/folds.scm
Normal file
17
queries/kotlin/folds.scm
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
[
|
||||||
|
(import_list)
|
||||||
|
|
||||||
|
(when_structure_body)
|
||||||
|
(control_structure_body)
|
||||||
|
|
||||||
|
(lambda_literal)
|
||||||
|
(function_body)
|
||||||
|
(primary_constructor)
|
||||||
|
(secondary_constructor)
|
||||||
|
(anonymous_initializer)
|
||||||
|
|
||||||
|
(class_body)
|
||||||
|
(enum_class_body)
|
||||||
|
|
||||||
|
(interpolated_expression)
|
||||||
|
] @fold
|
||||||
83
queries/kotlin/locals.scm
Normal file
83
queries/kotlin/locals.scm
Normal file
|
|
@ -0,0 +1,83 @@
|
||||||
|
;;; Imports
|
||||||
|
|
||||||
|
(package_header
|
||||||
|
. (identifier) @definiton.namespace)
|
||||||
|
|
||||||
|
(import_header
|
||||||
|
(identifier
|
||||||
|
(simple_identifier) @definition.import .)
|
||||||
|
(import_alias
|
||||||
|
(type_identifier) @definition.import)?)
|
||||||
|
|
||||||
|
;;; Functions
|
||||||
|
|
||||||
|
(function_declaration
|
||||||
|
. (simple_identifier) @definition.function
|
||||||
|
(#set! "definition.function.scope" "parent"))
|
||||||
|
|
||||||
|
(class_body
|
||||||
|
(function_declaration
|
||||||
|
. (simple_identifier) @definition.method)
|
||||||
|
(#set! "definition.method.scope" "parent"))
|
||||||
|
|
||||||
|
;;; Variables
|
||||||
|
|
||||||
|
(function_declaration
|
||||||
|
(parameter
|
||||||
|
(simple_identifier) @definition.parameter))
|
||||||
|
|
||||||
|
(lambda_literal
|
||||||
|
(lambda_parameters
|
||||||
|
(variable_declaration
|
||||||
|
(simple_identifier) @definition.parameter)))
|
||||||
|
|
||||||
|
(class_body
|
||||||
|
(property_declaration
|
||||||
|
(variable_declaration
|
||||||
|
(simple_identifier) @definition.field)))
|
||||||
|
|
||||||
|
(class_declaration
|
||||||
|
(primary_constructor
|
||||||
|
(class_parameter
|
||||||
|
(simple_identifier) @definition.field)))
|
||||||
|
|
||||||
|
(enum_class_body
|
||||||
|
(enum_entry
|
||||||
|
(simple_identifier) @definition.field))
|
||||||
|
|
||||||
|
(variable_declaration
|
||||||
|
(simple_identifier) @definition.var)
|
||||||
|
|
||||||
|
;;; Types
|
||||||
|
|
||||||
|
(class_declaration
|
||||||
|
(type_identifier) @definition.type
|
||||||
|
(#set! "definition.type.scope" "parent"))
|
||||||
|
|
||||||
|
(type_alias
|
||||||
|
(type_identifier) @definition.type
|
||||||
|
(#set! "definition.type.scope" "parent"))
|
||||||
|
|
||||||
|
;;; Scopes
|
||||||
|
|
||||||
|
[
|
||||||
|
(if_expression)
|
||||||
|
(when_expression)
|
||||||
|
(when_entry)
|
||||||
|
|
||||||
|
(for_statement)
|
||||||
|
(while_statement)
|
||||||
|
(do_while_statement)
|
||||||
|
|
||||||
|
(lambda_literal)
|
||||||
|
(function_declaration)
|
||||||
|
(primary_constructor)
|
||||||
|
(secondary_constructor)
|
||||||
|
(anonymous_initializer)
|
||||||
|
|
||||||
|
(class_declaration)
|
||||||
|
(enum_class_body)
|
||||||
|
(enum_entry)
|
||||||
|
|
||||||
|
(interpolated_expression)
|
||||||
|
] @scope
|
||||||
Loading…
Add table
Add a link
Reference in a new issue