mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
commit
79556b4155
3 changed files with 181 additions and 1 deletions
|
|
@ -166,7 +166,7 @@ List of currently supported languages:
|
|||
- [x] html (maintained by @TravonteD)
|
||||
- [ ] csharp
|
||||
- [ ] swift
|
||||
- [ ] java
|
||||
- [x] java
|
||||
- [ ] ocaml
|
||||
- [x] css (maintained by @TravonteD)
|
||||
- [ ] julia
|
||||
|
|
|
|||
172
queries/java/highlights.scm
Normal file
172
queries/java/highlights.scm
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
; Methods
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @method)
|
||||
(method_invocation
|
||||
name: (identifier) @method)
|
||||
(super) @function.builtin
|
||||
|
||||
; Annotations
|
||||
|
||||
(annotation
|
||||
name: (identifier) @attribute)
|
||||
(marker_annotation
|
||||
name: (identifier) @attribute)
|
||||
|
||||
; Operators
|
||||
[
|
||||
"@"
|
||||
"+"
|
||||
"++"
|
||||
"-"
|
||||
"--"
|
||||
"&"
|
||||
"&&"
|
||||
"|"
|
||||
"||"
|
||||
"!="
|
||||
"=="
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"<"
|
||||
"<="
|
||||
">"
|
||||
">="
|
||||
"="
|
||||
"-="
|
||||
"+="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
] @operator
|
||||
|
||||
; Types
|
||||
|
||||
(interface_declaration
|
||||
name: (identifier) @type)
|
||||
(class_declaration
|
||||
name: (identifier) @type)
|
||||
(enum_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
((field_access
|
||||
object: (identifier) @type)
|
||||
(#match? @type "^[A-Z]"))
|
||||
((scoped_identifier
|
||||
scope: (identifier) @type)
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
(constructor_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(type_identifier) @type
|
||||
(boolean_type) @type.builtin
|
||||
(integral_type) @type.builtin
|
||||
(floating_point_type) @type.builtin
|
||||
(floating_point_type) @type.builtin
|
||||
(void_type) @type.builtin
|
||||
|
||||
; Variables
|
||||
|
||||
((identifier) @constant
|
||||
(#match? @constant "^_*[A-Z][A-Z\d_]+"))
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
(this) @variable.builtin
|
||||
|
||||
; Literals
|
||||
|
||||
(hex_integer_literal) @number
|
||||
(decimal_integer_literal) @number
|
||||
(octal_integer_literal) @number
|
||||
(decimal_floating_point_literal) @float
|
||||
(hex_floating_point_literal) @float
|
||||
(character_literal) @character
|
||||
(string_literal) @string
|
||||
(null_literal) @constant.builtin
|
||||
|
||||
(comment) @comment
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @boolean
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"abstract"
|
||||
"assert"
|
||||
"break"
|
||||
"catch"
|
||||
"class"
|
||||
"continue"
|
||||
"default"
|
||||
"do"
|
||||
"enum"
|
||||
"exports"
|
||||
"extends"
|
||||
"final"
|
||||
"finally"
|
||||
"implements"
|
||||
"instanceof"
|
||||
"interface"
|
||||
"module"
|
||||
"native"
|
||||
"new"
|
||||
"open"
|
||||
"opens"
|
||||
"package"
|
||||
"private"
|
||||
"protected"
|
||||
"provides"
|
||||
"public"
|
||||
"requires"
|
||||
"return"
|
||||
"static"
|
||||
"strictfp"
|
||||
"synchronized"
|
||||
"throw"
|
||||
"throws"
|
||||
"to"
|
||||
"transient"
|
||||
"transitive"
|
||||
"try"
|
||||
"uses"
|
||||
"volatile"
|
||||
"with"
|
||||
] @keyword
|
||||
|
||||
; Conditionals
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"switch"
|
||||
"case"
|
||||
] @conditional
|
||||
|
||||
;
|
||||
|
||||
[
|
||||
"for"
|
||||
"while"
|
||||
] @repeat
|
||||
|
||||
;
|
||||
|
||||
"import" @include
|
||||
|
||||
; Punctuation
|
||||
|
||||
";" @punctuation.delimiter
|
||||
"." @punctuation.delimiter
|
||||
"," @punctuation.delimiter
|
||||
"[" @punctuation.bracket
|
||||
"]" @punctuation.bracket
|
||||
"{" @punctuation.bracket
|
||||
"}" @punctuation.bracket
|
||||
"(" @punctuation.bracket
|
||||
")" @punctuation.bracket
|
||||
8
queries/java/locals.scm
Normal file
8
queries/java/locals.scm
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
(class_declaration
|
||||
name: (identifier) @name) @class
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @name) @method
|
||||
|
||||
(method_invocation
|
||||
name: (identifier) @name) @call
|
||||
Loading…
Add table
Add a link
Reference in a new issue