nvim-treesitter/queries/java/locals.scm

54 lines
1.3 KiB
Scheme
Raw Normal View History

2020-07-20 01:05:23 +05:30
; SCOPES
2020-07-21 22:18:28 +05:30
; declarations
(class_declaration
2020-07-21 22:18:28 +05:30
body: (_) @scope)
2020-07-20 22:08:34 +05:30
(enum_declaration
2020-07-21 22:18:28 +05:30
body: (_) @scope)
2020-07-21 22:21:41 +05:30
(method_declaration) @scope ; whole method_declaration because arguments
2020-07-21 22:18:28 +05:30
; block
2020-07-20 01:15:09 +05:30
(block) @scope
2020-07-21 22:18:28 +05:30
; if/else
(if_statement) @scope ; if+else
2020-07-20 01:05:23 +05:30
(if_statement
2020-07-21 22:18:28 +05:30
consequence: (_) @scope) ; if body in case there are no braces
2020-07-20 01:05:23 +05:30
(if_statement
2020-07-21 22:18:28 +05:30
alternative: (_) @scope) ; else body in case there are no braces
; try/catch
(try_statement) @scope ; covers try+catch, individual try and catch are covered by (block)
2020-07-22 05:10:56 +05:30
(catch_clause) @scope ; needed because `Exception` variable
2020-07-21 22:18:28 +05:30
; loops
2020-07-21 22:21:41 +05:30
(for_statement) @scope ; whole for_statement because loop iterator variable
2020-07-21 22:18:28 +05:30
(for_statement ; "for" body in case there are no braces
body: (_) @scope)
2020-07-20 22:08:34 +05:30
(do_statement
body: (_) @scope)
(while_statement
body: (_) @scope)
2020-07-21 22:18:28 +05:30
2020-07-20 01:05:23 +05:30
; DEFINITIONS
2020-07-19 17:41:24 +00:00
(class_declaration
name: (identifier) @definition.class)
2020-07-20 22:08:34 +05:30
(enum_declaration
name: (identifier) @definition.enum)
2020-07-19 17:41:24 +00:00
(method_declaration
name: (identifier) @definition.method)
2020-07-20 17:07:12 +05:30
(local_variable_declaration
declarator: (variable_declarator
name: (identifier) @definition.var))
(field_declaration
declarator: (variable_declarator
name: (identifier) @definition.field))
(import_declaration) @definition.import
2020-07-20 12:34:33 +05:30
2020-07-21 22:18:28 +05:30
2020-07-20 17:07:12 +05:30
; REFERENCES
2020-07-20 12:34:33 +05:30
(identifier) @reference
(type_identifier) @reference