diff options
| author | Pham Huy Hoang <hoangtun0810@gmail.com> | 2024-01-06 15:05:50 +0900 |
|---|---|---|
| committer | Christian Clason <c.clason@uni-graz.at> | 2024-01-19 16:58:37 +0100 |
| commit | 57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 (patch) | |
| tree | 70bf645539882b88e6fa129cefd30986b89bbac3 /queries/apex | |
| parent | ci: add query lint job (diff) | |
| download | nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.gz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.bz2 nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.lz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.xz nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.tar.zst nvim-treesitter-57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9.zip | |
chore: query formatting
Diffstat (limited to 'queries/apex')
| -rw-r--r-- | queries/apex/folds.scm | 8 | ||||
| -rw-r--r-- | queries/apex/highlights.scm | 149 | ||||
| -rw-r--r-- | queries/apex/locals.scm | 36 |
3 files changed, 105 insertions, 88 deletions
diff --git a/queries/apex/folds.scm b/queries/apex/folds.scm index 0ffc550e9..fdfc2a1ed 100644 --- a/queries/apex/folds.scm +++ b/queries/apex/folds.scm @@ -1,6 +1,6 @@ [ - (class_body) - (constructor_declaration) - (argument_list) - (annotation_argument_list) + (class_body) + (constructor_declaration) + (argument_list) + (annotation_argument_list) ] @fold diff --git a/queries/apex/highlights.scm b/queries/apex/highlights.scm index 692fccb1b..64ff9168c 100644 --- a/queries/apex/highlights.scm +++ b/queries/apex/highlights.scm @@ -1,7 +1,5 @@ ; inherits: soql - -;;; Apex + SOQL - +; Apex + SOQL [ "[" "]" @@ -17,16 +15,14 @@ ":" "?" ";" - ] @punctuation.delimiter - -;; Default general color defination +] @punctuation.delimiter +; Default general color defination (identifier) @variable (type_identifier) @type -;; Methods - +; Methods (method_declaration name: (identifier) @function.method) @@ -35,13 +31,11 @@ (super) @function.builtin -;; Annotations - +; Annotations (annotation name: (identifier) @attribute) -;; Types - +; Types (interface_declaration name: (identifier) @type) @@ -49,7 +43,7 @@ name: (identifier) @type) (class_declaration - (superclass) @type) + (superclass) @type) (enum_declaration name: (identifier) @type) @@ -57,8 +51,11 @@ (enum_constant name: (identifier) @constant) -(type_arguments "<" @punctuation.delimiter) -(type_arguments ">" @punctuation.delimiter) +(type_arguments + "<" @punctuation.delimiter) + +(type_arguments + ">" @punctuation.delimiter) ((field_access object: (identifier) @type)) @@ -68,11 +65,11 @@ ((scoped_identifier scope: (identifier) @type) - (#match? @type "^[A-Z]")) + (#match? @type "^[A-Z]")) ((method_invocation object: (identifier) @type) - (#match? @type "^[A-Z]")) + (#match? @type "^[A-Z]")) (method_declaration (formal_parameters @@ -86,16 +83,21 @@ (assignment_operator) @operator -(update_expression ["++" "--"] @operator) +(update_expression + [ + "++" + "--" + ] @operator) (trigger_declaration name: (identifier) @type object: (identifier) @type (trigger_event) @keyword - ("," (trigger_event) @keyword)*) + ("," + (trigger_event) @keyword)*) [ - "@" + "@" "=" "!=" "<=" @@ -103,35 +105,39 @@ ] @operator (binary_expression - operator: [ - ">" - "<" - "==" - "===" - "!==" - "&&" - "||" - "+" - "-" - "*" - "/" - "&" - "|" - "^" - "%" - "<<" - ">>" - ">>>"] @operator) + operator: + [ + ">" + "<" + "==" + "===" + "!==" + "&&" + "||" + "+" + "-" + "*" + "/" + "&" + "|" + "^" + "%" + "<<" + ">>" + ">>>" + ] @operator) (unary_expression - operator: [ - "+" - "-" - "!" - "~" - ]) @operator + operator: + [ + "+" + "-" + "!" + "~" + ]) @operator -(map_initializer "=>" @operator) +(map_initializer + "=>" @operator) [ (boolean_type) @@ -139,18 +145,27 @@ ] @type.builtin ; Fields - (field_declaration - declarator: (variable_declarator - name: (identifier) @variable.member)) + declarator: + (variable_declarator + name: (identifier) @variable.member)) (field_access field: (identifier) @variable.member) ; Variables - (field_declaration - (modifiers (modifier ["final" "static"])(modifier ["final" "static"])) + (modifiers + (modifier + [ + "final" + "static" + ]) + (modifier + [ + "final" + "static" + ])) (variable_declarator name: (identifier) @constant)) @@ -163,7 +178,6 @@ (this) @variable.builtin ; Literals - [ (int) (decimal) @@ -179,16 +193,15 @@ (null_literal) @constant.builtin -;; ;; Keywords - +; ;; Keywords [ - "abstract" - "final" - "private" - "protected" - "public" - "static" - ] @type.qualifier + "abstract" + "final" + "private" + "protected" + "public" + "static" +] @type.qualifier [ "if" @@ -203,16 +216,14 @@ "break" ] @keyword.repeat -[ - "return" -] @keyword.return +"return" @keyword.return [ - "throw" - "finally" - "try" - "catch" - ] @keyword.exception + "throw" + "finally" + "try" + "catch" +] @keyword.exception "new" @keyword.operator diff --git a/queries/apex/locals.scm b/queries/apex/locals.scm index 5661b911d..d3cbfa73b 100644 --- a/queries/apex/locals.scm +++ b/queries/apex/locals.scm @@ -1,41 +1,46 @@ ; declarations - (class_declaration) @local.scope + (method_declaration) @local.scope + (constructor_declaration) @local.scope + (enum_declaration) @local.scope + (enhanced_for_statement) @local.scope ; if/else - (if_statement) @local.scope + (if_statement consequence: (_) @local.scope) ; if body in case there are no braces + (if_statement alternative: (_) @local.scope) ; else body in case there are no braces ; try/catch - (try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block) + (catch_clause) @local.scope ; needed because `Exception` variable ; loops - (for_statement) @local.scope -(for_statement ; "for" body in case there are no braces + +(for_statement ; "for" body in case there are no braces body: (_) @local.scope) + (do_statement body: (_) @local.scope) + (while_statement body: (_) @local.scope) ; Functions - (constructor_declaration) @local.scope -(method_declaration) @local.scope -;; definitions +(method_declaration) @local.scope +; definitions (enum_declaration name: (identifier) @local.definition.enum) @@ -43,10 +48,11 @@ name: (identifier) @local.definition.method) (local_variable_declaration - declarator: (variable_declarator - name: (identifier) @local.definition.var)) + declarator: + (variable_declarator + name: (identifier) @local.definition.var)) -(enhanced_for_statement +(enhanced_for_statement name: (identifier) @local.definition.var) (formal_parameter @@ -56,11 +62,11 @@ name: (identifier) @local.definition.parameter) (field_declaration - declarator: (variable_declarator - name: (identifier) @local.definition.field)) - -;; REFERENCES + declarator: + (variable_declarator + name: (identifier) @local.definition.field)) +; REFERENCES (identifier) @local.reference (type_identifier) @local.reference |
