Update tree-sitter-java and add Java textobjects (#4886)
This commit is contained in:
parent
8529d756fa
commit
fc811726e0
5 changed files with 55 additions and 5 deletions
|
@ -56,7 +56,7 @@
|
||||||
| idris | | | | `idris2-lsp` |
|
| idris | | | | `idris2-lsp` |
|
||||||
| iex | ✓ | | | |
|
| iex | ✓ | | | |
|
||||||
| ini | ✓ | | | |
|
| ini | ✓ | | | |
|
||||||
| java | ✓ | | | `jdtls` |
|
| java | ✓ | ✓ | | `jdtls` |
|
||||||
| javascript | ✓ | ✓ | ✓ | `typescript-language-server` |
|
| javascript | ✓ | ✓ | ✓ | `typescript-language-server` |
|
||||||
| jsdoc | ✓ | | | |
|
| jsdoc | ✓ | | | |
|
||||||
| json | ✓ | | ✓ | `vscode-json-language-server` |
|
| json | ✓ | | ✓ | `vscode-json-language-server` |
|
||||||
|
|
|
@ -617,7 +617,7 @@ indent = { tab-width = 4, unit = " " }
|
||||||
|
|
||||||
[[grammar]]
|
[[grammar]]
|
||||||
name = "java"
|
name = "java"
|
||||||
source = { git = "https://github.com/tree-sitter/tree-sitter-java", rev = "bd6186c24d5eb13b4623efac9d944dcc095c0dad" }
|
source = { git = "https://github.com/tree-sitter/tree-sitter-java", rev = "09d650def6cdf7f479f4b78f595e9ef5b58ce31e" }
|
||||||
|
|
||||||
[[language]]
|
[[language]]
|
||||||
name = "ledger"
|
name = "ledger"
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
(class_declaration
|
(class_declaration
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
(record_declaration
|
||||||
|
name: (identifier) @type)
|
||||||
(enum_declaration
|
(enum_declaration
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
|
||||||
|
@ -33,6 +35,8 @@
|
||||||
|
|
||||||
(constructor_declaration
|
(constructor_declaration
|
||||||
name: (identifier) @type)
|
name: (identifier) @type)
|
||||||
|
(compact_constructor_declaration
|
||||||
|
name: (identifier) @type)
|
||||||
|
|
||||||
(type_identifier) @type
|
(type_identifier) @type
|
||||||
|
|
||||||
|
@ -59,6 +63,7 @@
|
||||||
(hex_integer_literal)
|
(hex_integer_literal)
|
||||||
(decimal_integer_literal)
|
(decimal_integer_literal)
|
||||||
(octal_integer_literal)
|
(octal_integer_literal)
|
||||||
|
(binary_integer_literal)
|
||||||
] @constant.numeric.integer
|
] @constant.numeric.integer
|
||||||
|
|
||||||
[
|
[
|
||||||
|
@ -67,7 +72,11 @@
|
||||||
] @constant.numeric.float
|
] @constant.numeric.float
|
||||||
|
|
||||||
(character_literal) @constant.character
|
(character_literal) @constant.character
|
||||||
(string_literal) @string
|
|
||||||
|
[
|
||||||
|
(string_literal)
|
||||||
|
(text_block)
|
||||||
|
] @string
|
||||||
|
|
||||||
[
|
[
|
||||||
(true)
|
(true)
|
||||||
|
@ -75,7 +84,8 @@
|
||||||
(null_literal)
|
(null_literal)
|
||||||
] @constant.builtin
|
] @constant.builtin
|
||||||
|
|
||||||
(comment) @comment
|
(line_comment) @comment
|
||||||
|
(block_comment) @comment
|
||||||
|
|
||||||
; Keywords
|
; Keywords
|
||||||
|
|
||||||
|
@ -104,15 +114,19 @@
|
||||||
"module"
|
"module"
|
||||||
"native"
|
"native"
|
||||||
"new"
|
"new"
|
||||||
|
"non-sealed"
|
||||||
"open"
|
"open"
|
||||||
"opens"
|
"opens"
|
||||||
"package"
|
"package"
|
||||||
|
"permits"
|
||||||
"private"
|
"private"
|
||||||
"protected"
|
"protected"
|
||||||
"provides"
|
"provides"
|
||||||
"public"
|
"public"
|
||||||
"requires"
|
"requires"
|
||||||
|
"record"
|
||||||
"return"
|
"return"
|
||||||
|
"sealed"
|
||||||
"static"
|
"static"
|
||||||
"strictfp"
|
"strictfp"
|
||||||
"switch"
|
"switch"
|
||||||
|
@ -127,4 +141,5 @@
|
||||||
"volatile"
|
"volatile"
|
||||||
"while"
|
"while"
|
||||||
"with"
|
"with"
|
||||||
|
"yield"
|
||||||
] @keyword
|
] @keyword
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
((comment) @injection.content
|
([(line_comment) (block_comment)] @injection.content
|
||||||
(#set! injection.language "comment"))
|
(#set! injection.language "comment"))
|
||||||
|
|
35
runtime/queries/java/textobjects.scm
Normal file
35
runtime/queries/java/textobjects.scm
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
(method_declaration
|
||||||
|
body: (_) @function.inside) @function.around
|
||||||
|
|
||||||
|
(interface_declaration
|
||||||
|
body: (_) @class.inside) @class.around
|
||||||
|
|
||||||
|
(class_declaration
|
||||||
|
body: (_) @class.inside) @class.around
|
||||||
|
|
||||||
|
(record_declaration
|
||||||
|
body: (_) @class.inside) @class.around
|
||||||
|
|
||||||
|
(enum_declaration
|
||||||
|
body: (_) @class.inside) @class.around
|
||||||
|
|
||||||
|
(formal_parameters
|
||||||
|
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||||
|
|
||||||
|
(type_parameters
|
||||||
|
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||||
|
|
||||||
|
(type_arguments
|
||||||
|
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||||
|
|
||||||
|
(argument_list
|
||||||
|
((_) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||||
|
|
||||||
|
[
|
||||||
|
(line_comment)
|
||||||
|
(block_comment)
|
||||||
|
] @comment.inside
|
||||||
|
|
||||||
|
(line_comment)+ @comment.around
|
||||||
|
|
||||||
|
(block_comment) @comment.around
|
Loading…
Add table
Reference in a new issue