diff options
| author | Chinmay Dalal <chinmay.dalal.22012001@gmail.com> | 2020-06-29 14:18:13 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-06-29 10:48:13 +0200 |
| commit | b184f1cafbe7316ae8671b7eafec5a11383b4fd6 (patch) | |
| tree | 3918dd6512a14ac4eae33c019961a1216dbfef2a /queries/java | |
| parent | C highlights: Add highlight for #elif (diff) | |
| download | nvim-treesitter-b184f1cafbe7316ae8671b7eafec5a11383b4fd6.tar nvim-treesitter-b184f1cafbe7316ae8671b7eafec5a11383b4fd6.tar.gz nvim-treesitter-b184f1cafbe7316ae8671b7eafec5a11383b4fd6.tar.bz2 nvim-treesitter-b184f1cafbe7316ae8671b7eafec5a11383b4fd6.tar.lz nvim-treesitter-b184f1cafbe7316ae8671b7eafec5a11383b4fd6.tar.xz nvim-treesitter-b184f1cafbe7316ae8671b7eafec5a11383b4fd6.tar.zst nvim-treesitter-b184f1cafbe7316ae8671b7eafec5a11383b4fd6.zip | |
Java highlights: Capture parameters in declaration (#93)
* Capture parameters in declaration
* Refactor (new syntax)
* Fix spaces
* Fix capture (java method parameters)
* Improve java parameter capture
* Fix bracket and whitespace
* Fix java query
* Fix java query
Co-authored-by: Thomas Vigouroux <39092278+vigoux@users.noreply.github.com>
* Add capture for lambda parameters, remove redundant captures, add -> operator
* Previous commit wasn't saved properly
* Fix formatting
* Changes suggested in PR
https://github.com/nvim-treesitter/nvim-treesitter/pull/93#pullrequestreview-435630553
* Add bitwise operators
* Re-add builtin operators
* remove left shift, add ^=
* Add &= and |=
* remove @variable
* Remove duplicate
Co-authored-by: Thomas Vigouroux <39092278+vigoux@users.noreply.github.com>
Diffstat (limited to 'queries/java')
| -rw-r--r-- | queries/java/highlights.scm | 95 |
1 files changed, 64 insertions, 31 deletions
diff --git a/queries/java/highlights.scm b/queries/java/highlights.scm index e51099e58..8d50ebfd6 100644 --- a/queries/java/highlights.scm +++ b/queries/java/highlights.scm @@ -2,20 +2,32 @@ ; Methods + (method_declaration name: (identifier) @method) (method_invocation name: (identifier) @method) + (super) @function.builtin +; Parameters +(formal_parameter + name: (identifier) @parameter) + +(inferred_parameters (identifier) @parameter) + + ; Annotations + (annotation name: (identifier) @attribute) (marker_annotation name: (identifier) @attribute) + ; Operators + [ "@" "+" @@ -41,6 +53,15 @@ "*=" "/=" "%=" +"->" +"^" +"^=" +"&=" +"|=" +"~" +">>" +">>>" +"<<" ] @operator ; Types @@ -51,40 +72,46 @@ name: (identifier) @type) (enum_declaration name: (identifier) @type) +(constructor_declaration + name: (identifier) @type) +(type_identifier) @type + + ((field_access object: (identifier) @type) - (#match? @type "^[A-Z]")) + (#match? @type "^[A-Z]")) ((scoped_identifier scope: (identifier) @type) - (#match? @type "^[A-Z]")) + (#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 +[ +(boolean_type) +(integral_type) +(floating_point_type) +(void_type) +] @type.builtin ; Variables ((identifier) @constant - (#match? @constant "^_*[A-Z][A-Z\d_]+")) + (#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 +[ +(hex_integer_literal) +(decimal_integer_literal) +(octal_integer_literal) +] @number + +[ +(decimal_floating_point_literal) +(hex_floating_point_literal) +] @float + (character_literal) @character (string_literal) @string (null_literal) @constant.builtin @@ -106,7 +133,6 @@ "class" "continue" "default" -"do" "enum" "exports" "extends" @@ -150,25 +176,32 @@ "case" ] @conditional -; +; [ "for" "while" +"do" ] @repeat -; +; Includes "import" @include +"package" @include ; Punctuation -";" @punctuation.delimiter -"." @punctuation.delimiter -"," @punctuation.delimiter -"[" @punctuation.bracket -"]" @punctuation.bracket -"{" @punctuation.bracket -"}" @punctuation.bracket -"(" @punctuation.bracket -")" @punctuation.bracket +[ +";" +"." +"," +] @punctuation.delimiter + +[ +"[" +"]" +"{" +"}" +"(" +")" +] @punctuation.bracket |
