diff options
Diffstat (limited to 'queries/java/highlights.scm')
| -rw-r--r-- | queries/java/highlights.scm | 98 |
1 files changed, 59 insertions, 39 deletions
diff --git a/queries/java/highlights.scm b/queries/java/highlights.scm index 4ff56641d..ee36bf0bf 100644 --- a/queries/java/highlights.scm +++ b/queries/java/highlights.scm @@ -1,20 +1,17 @@ ; CREDITS @maxbrunsfeld (maxbrunsfeld@gmail.com) - ; Variables - (identifier) @variable ; Methods - (method_declaration name: (identifier) @function.method) + (method_invocation name: (identifier) @function.method.call) (super) @function.builtin ; Parameters - (formal_parameter name: (identifier) @variable.parameter) @@ -22,18 +19,17 @@ name: (identifier) @variable.parameter) (spread_parameter - (variable_declarator - name: (identifier) @variable.parameter)) ; int... foo + (variable_declarator + name: (identifier) @variable.parameter)) ; int... foo -;; Lambda parameter - -(inferred_parameters (identifier) @variable.parameter) ; (x,y) -> ... +; Lambda parameter +(inferred_parameters + (identifier) @variable.parameter) ; (x,y) -> ... (lambda_expression - parameters: (identifier) @variable.parameter) ; x -> ... + parameters: (identifier) @variable.parameter) ; x -> ... ; Operators - [ "+" ":" @@ -73,41 +69,51 @@ ] @operator ; Types - (interface_declaration name: (identifier) @type) + (annotation_type_declaration name: (identifier) @type) + (class_declaration name: (identifier) @type) + (record_declaration name: (identifier) @type) + (enum_declaration name: (identifier) @type) + (constructor_declaration name: (identifier) @type) + (type_identifier) @type + ((type_identifier) @type.builtin (#eq? @type.builtin "var")) + ((method_invocation object: (identifier) @type) - (#lua-match? @type "^[A-Z]")) + (#lua-match? @type "^[A-Z]")) + ((method_reference - . (identifier) @type) - (#lua-match? @type "^[A-Z]")) + . + (identifier) @type) + (#lua-match? @type "^[A-Z]")) ((field_access object: (identifier) @type) (#lua-match? @type "^[A-Z]")) + (scoped_identifier (identifier) @type (#lua-match? @type "^[A-Z]")) ; Fields - (field_declaration - declarator: (variable_declarator - name: (identifier) @variable.member)) + declarator: + (variable_declarator + name: (identifier) @variable.member)) (field_access field: (identifier) @variable.member) @@ -120,23 +126,21 @@ ] @type.builtin ; Variables - ((identifier) @constant (#lua-match? @constant "^[A-Z_][A-Z%d_]+$")) (this) @variable.builtin ; Annotations - (annotation "@" @attribute name: (identifier) @attribute) + (marker_annotation "@" @attribute name: (identifier) @attribute) ; Literals - (string_literal) @string (escape_sequence) @string.escape @@ -163,7 +167,6 @@ (null_literal) @constant.builtin ; Keywords - [ "assert" "class" @@ -211,12 +214,9 @@ "yield" ] @keyword.return -[ - "new" -] @keyword.operator +"new" @keyword.operator ; Conditionals - [ "if" "else" @@ -224,10 +224,13 @@ "case" ] @keyword.conditional -(ternary_expression ["?" ":"] @keyword.conditional.ternary) +(ternary_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) ; Loops - [ "for" "while" @@ -237,7 +240,6 @@ ] @keyword.repeat ; Includes - [ "exports" "import" @@ -250,7 +252,6 @@ ] @keyword.import ; Punctuation - [ ";" "." @@ -258,19 +259,40 @@ "," ] @punctuation.delimiter -[ "{" "}" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -(type_arguments [ "<" ">" ] @punctuation.bracket) -(type_parameters [ "<" ">" ] @punctuation.bracket) +(type_arguments + [ + "<" + ">" + ] @punctuation.bracket) -(string_interpolation [ "\\{" "}" ] @punctuation.special) +(type_parameters + [ + "<" + ">" + ] @punctuation.bracket) -; Exceptions +(string_interpolation + [ + "\\{" + "}" + ] @punctuation.special) +; Exceptions [ "throw" "throws" @@ -280,12 +302,10 @@ ] @keyword.exception ; Labels - (labeled_statement (identifier) @label) ; Comments - [ (line_comment) (block_comment) |
