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
|
||||
; declarations
|
||||
(class_declaration
|
||||
body: (_) @scope)
|
||||
body: (_) @scope)
|
||||
(enum_declaration
|
||||
body: (_) @scope)
|
||||
(method_declaration) @scope
|
||||
body: (_) @scope)
|
||||
(method_declaration) @scope ; whole method_declaration because args
|
||||
|
||||
; block
|
||||
(block) @scope
|
||||
(if_statement) @scope
|
||||
|
||||
; if/else
|
||||
(if_statement) @scope ; if+else
|
||||
(if_statement
|
||||
consequence: (_) @scope)
|
||||
consequence: (_) @scope) ; if body in case there are no braces
|
||||
(if_statement
|
||||
alternative: (_) @scope)
|
||||
(try_statement) @scope
|
||||
(catch_clause) @scope
|
||||
(do_statement) @scope
|
||||
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)
|
||||
|
||||
; loops
|
||||
(for_statement) @scope ; whole for_statement because loop variable
|
||||
(for_statement ; "for" body in case there are no braces
|
||||
body: (_) @scope)
|
||||
(do_statement
|
||||
body: (_) @scope)
|
||||
(while_statement) @scope
|
||||
(while_statement
|
||||
body: (_) @scope)
|
||||
(for_statement) @scope
|
||||
(for_statement
|
||||
body: (_) @scope)
|
||||
|
||||
|
||||
|
||||
; DEFINITIONS
|
||||
(class_declaration
|
||||
|
|
@ -37,6 +45,8 @@
|
|||
name: (identifier) @definition.field))
|
||||
(import_declaration) @definition.import
|
||||
|
||||
|
||||
|
||||
; REFERENCES
|
||||
(identifier) @reference
|
||||
(type_identifier) @reference
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue