mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-21 12:50:09 -04:00
java locals.scm - fixes
This commit is contained in:
parent
d446b5d635
commit
e7294b203e
1 changed files with 23 additions and 13 deletions
|
|
@ -1,26 +1,34 @@
|
||||||
; SCOPES
|
; SCOPES
|
||||||
|
; declarations
|
||||||
(class_declaration
|
(class_declaration
|
||||||
body: (_) @scope)
|
body: (_) @scope)
|
||||||
(enum_declaration
|
(enum_declaration
|
||||||
body: (_) @scope)
|
body: (_) @scope)
|
||||||
(method_declaration) @scope
|
(method_declaration) @scope ; whole method_declaration because args
|
||||||
|
|
||||||
|
; block
|
||||||
(block) @scope
|
(block) @scope
|
||||||
(if_statement) @scope
|
|
||||||
|
; if/else
|
||||||
|
(if_statement) @scope ; if+else
|
||||||
(if_statement
|
(if_statement
|
||||||
consequence: (_) @scope)
|
consequence: (_) @scope) ; if body in case there are no braces
|
||||||
(if_statement
|
(if_statement
|
||||||
alternative: (_) @scope)
|
alternative: (_) @scope) ; else body in case there are no braces
|
||||||
(try_statement) @scope
|
|
||||||
(catch_clause) @scope
|
; try/catch
|
||||||
(do_statement) @scope
|
(try_statement) @scope ; covers try+catch, individual try and catch are covered by (block)
|
||||||
|
|
||||||
|
; loops
|
||||||
|
(for_statement) @scope ; whole for_statement because loop variable
|
||||||
|
(for_statement ; "for" body in case there are no braces
|
||||||
|
body: (_) @scope)
|
||||||
(do_statement
|
(do_statement
|
||||||
body: (_) @scope)
|
body: (_) @scope)
|
||||||
(while_statement) @scope
|
|
||||||
(while_statement
|
(while_statement
|
||||||
body: (_) @scope)
|
body: (_) @scope)
|
||||||
(for_statement) @scope
|
|
||||||
(for_statement
|
|
||||||
body: (_) @scope)
|
|
||||||
|
|
||||||
; DEFINITIONS
|
; DEFINITIONS
|
||||||
(class_declaration
|
(class_declaration
|
||||||
|
|
@ -37,6 +45,8 @@
|
||||||
name: (identifier) @definition.field))
|
name: (identifier) @definition.field))
|
||||||
(import_declaration) @definition.import
|
(import_declaration) @definition.import
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
; REFERENCES
|
; REFERENCES
|
||||||
(identifier) @reference
|
(identifier) @reference
|
||||||
(type_identifier) @reference
|
(type_identifier) @reference
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue