nvim-treesitter/queries/java/highlights.scm

261 lines
2.9 KiB
Scheme
Raw Normal View History

2020-06-17 18:01:29 +05:30
; CREDITS @maxbrunsfeld (maxbrunsfeld@gmail.com)
; Variables
2020-06-11 22:31:45 +05:30
(identifier) @variable
; Methods
2020-06-11 22:31:45 +05:30
(method_declaration
2020-06-15 21:48:50 +05:30
name: (identifier) @method)
2020-06-11 22:31:45 +05:30
(method_invocation
2020-06-15 21:48:50 +05:30
name: (identifier) @method)
2020-06-11 22:31:45 +05:30
(super) @function.builtin
; Parameters
(formal_parameter
name: (identifier) @parameter)
(catch_formal_parameter
name: (identifier) @parameter)
(spread_parameter
(variable_declarator) @parameter) ; int... foo
;; Lambda parameter
(inferred_parameters (identifier) @parameter) ; (x,y) -> ...
(lambda_expression
parameters: (identifier) @parameter) ; x -> ...
2020-06-11 22:31:45 +05:30
; Annotations
2020-06-11 22:31:45 +05:30
(annotation
name: (identifier) @attribute)
(marker_annotation
name: (identifier) @attribute)
2020-06-15 22:45:56 +05:30
; Operators
2020-06-15 22:45:56 +05:30
[
"@"
"+"
2020-06-30 07:48:55 +02:00
":"
2020-06-15 22:45:56 +05:30
"++"
"-"
"--"
"&"
"&&"
"|"
"||"
"!="
"=="
"*"
"/"
"%"
"<"
"<="
">"
">="
"="
"-="
"+="
"*="
"/="
"%="
"->"
"^"
"^="
"&="
"|="
"~"
">>"
">>>"
"<<"
2020-06-29 21:55:52 +05:30
"::"
2020-06-15 22:45:56 +05:30
] @operator
2020-06-11 22:31:45 +05:30
; Types
(interface_declaration
name: (identifier) @type)
(class_declaration
name: (identifier) @type)
(record_declaration
name: (identifier) @type)
2020-06-11 22:31:45 +05:30
(enum_declaration
name: (identifier) @type)
(constructor_declaration
name: (identifier) @type)
(type_identifier) @type
((method_invocation
object: (identifier) @type)
(#lua-match? @type "^[A-Z]"))
((method_reference
. (identifier) @type)
(#lua-match? @type "^[A-Z]"))
2020-06-11 22:31:45 +05:30
((field_access
object: (identifier) @type)
(#lua-match? @type "^[A-Z]"))
2020-06-11 22:31:45 +05:30
((scoped_identifier
scope: (identifier) @type)
(#lua-match? @type "^[A-Z]"))
2020-06-11 22:31:45 +05:30
; Fields
(field_declaration
declarator: (variable_declarator) @field)
(field_access
field: (identifier) @field)
[
(boolean_type)
(integral_type)
(floating_point_type)
(void_type)
] @type.builtin
2020-06-11 22:31:45 +05:30
; Variables
((identifier) @constant
(#lua-match? @constant "^[A-Z_][A-Z%d_]+$"))
2020-06-11 22:31:45 +05:30
(this) @variable.builtin
2020-06-11 22:31:45 +05:30
; Literals
[
(hex_integer_literal)
(decimal_integer_literal)
(octal_integer_literal)
(binary_integer_literal)
] @number
[
(decimal_floating_point_literal)
(hex_floating_point_literal)
] @float
2020-06-15 23:23:17 +05:30
(character_literal) @character
2020-06-11 22:31:45 +05:30
(string_literal) @string
(null_literal) @constant.builtin
[
(line_comment)
(block_comment)
] @comment
2020-06-11 22:31:45 +05:30
[
(true)
(false)
] @boolean
; Keywords
[
"abstract"
"assert"
"break"
"class"
"record"
2020-06-11 22:31:45 +05:30
"continue"
"default"
"enum"
"exports"
"extends"
"final"
"implements"
"instanceof"
"interface"
"module"
"native"
"open"
"opens"
"package"
"private"
"protected"
"provides"
"public"
"requires"
"static"
"strictfp"
"synchronized"
"to"
"transient"
"transitive"
"uses"
"volatile"
"with"
] @keyword
[
"return"
"yield"
] @keyword.return
[
"new"
] @keyword.operator
2020-06-11 22:31:45 +05:30
; Conditionals
[
"if"
"else"
"switch"
"case"
] @conditional
2020-11-19 16:03:58 +05:30
(ternary_expression ["?" ":"] @conditional)
;
2020-06-11 22:31:45 +05:30
[
"for"
"while"
"do"
2020-06-11 22:31:45 +05:30
] @repeat
; Includes
2020-06-11 22:31:45 +05:30
"import" @include
"package" @include
2020-06-11 22:31:45 +05:30
; Punctuation
[
";"
"."
"..."
","
] @punctuation.delimiter
[
"["
"]"
"{"
"}"
"("
")"
] @punctuation.bracket
2020-08-16 10:26:11 +05:30
; Exceptions
[
"throw"
"throws"
"finally"
"try"
"catch"
] @exception
2020-08-16 10:26:11 +05:30
; Labels
(labeled_statement
(identifier) @label)