mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-08 14:30:05 -04:00
Update queries
- Don't use the old form for predicates - Update some invalid queries
This commit is contained in:
parent
6c5f4b1b49
commit
56634f49ab
7 changed files with 19 additions and 19 deletions
|
|
@ -229,7 +229,7 @@ doSomething(); // Should point to the declaration as the definition
|
|||
```scheme
|
||||
(function_declaration
|
||||
((identifier) @definition.var)
|
||||
(set! "definition.var.scope" "parent"))
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
```
|
||||
|
||||
Possible scope values are:
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
((scoped_identifier
|
||||
(identifier) @definition.import)
|
||||
(has-ancestor? @definition.import import_declaration))
|
||||
(#has-ancestor? @definition.import import_declaration))
|
||||
|
||||
(field_declaration
|
||||
declarator: (variable_declarator
|
||||
|
|
@ -74,5 +74,4 @@
|
|||
|
||||
; REFERENCES
|
||||
(identifier) @reference
|
||||
((type_identifier) @reference
|
||||
(set! reference.kind "type"))
|
||||
(type_identifier) @reference
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
;((identifier) @type ; exception: mark `A_foo` sort of identifiers as variables
|
||||
;(match? @type "^[A-Z][^_]"))
|
||||
((identifier) @constant
|
||||
(match? @constant "^[A-Z][A-Z_]{2}[A-Z_]*$"))
|
||||
(#match? @constant "^[A-Z][A-Z_]{2}[A-Z_]*$"))
|
||||
|
||||
[
|
||||
(triple_string)
|
||||
|
|
@ -89,11 +89,11 @@
|
|||
(number) @number
|
||||
(range_expression
|
||||
(identifier) @number
|
||||
(eq? @number "end"))
|
||||
(#eq? @number "end"))
|
||||
(range_expression
|
||||
(_
|
||||
(identifier) @number
|
||||
(eq? @number "end")))
|
||||
(#eq? @number "end")))
|
||||
(coefficient_expression
|
||||
(number)
|
||||
(identifier) @constant.builtin)
|
||||
|
|
@ -173,9 +173,9 @@
|
|||
|
||||
((identifier) @include (#eq? @include "baremodule"))
|
||||
|
||||
(((identifier) @constant.builtin) (match? @constant.builtin "^(nothing|Inf|NaN)$"))
|
||||
(((identifier) @boolean) (eq? @boolean "true"))
|
||||
(((identifier) @boolean) (eq? @boolean "false"))
|
||||
(((identifier) @constant.builtin) (#match? @constant.builtin "^(nothing|Inf|NaN)$"))
|
||||
(((identifier) @boolean) (#eq? @boolean "true"))
|
||||
(((identifier) @boolean) (#eq? @boolean "false"))
|
||||
|
||||
["::" ":" "." "," "..." "!"] @punctuation.delimiter
|
||||
["[" "]" "(" ")" "{" "}"] @punctuation.bracket
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@
|
|||
|
||||
((call
|
||||
function: (identifier) @function.builtin)
|
||||
(any-of? @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod"
|
||||
"compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format"
|
||||
"frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass"
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@
|
|||
; SOFTWARE.
|
||||
|
||||
;;; DECLARATIONS AND SCOPES
|
||||
((method) @scope
|
||||
(set! scope-inherits false))
|
||||
(method) @scope
|
||||
(class) @scope
|
||||
|
||||
[
|
||||
|
|
@ -49,7 +48,7 @@
|
|||
(block_parameter name: (identifier) @definition.var)
|
||||
(keyword_parameter name: (identifier) @definition.var)
|
||||
|
||||
(assignment left: (_lhs) @definition.var)
|
||||
(assignment left: (_) @definition.var)
|
||||
|
||||
(left_assignment_list (identifier) @definition.var)
|
||||
(rest_assignment (identifier) @definition.var)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
(group_graph_pattern (triples_block) @scope)
|
||||
|
||||
(sub_select (select_clause (var) @definition.var)(set! "definition.var.scope" "parent"))
|
||||
(select_query (select_clause (var) @definition.var)(set! "definition.var.scope" "parent"))
|
||||
((sub_select (select_clause (var) @definition.var))
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
((select_query (select_clause (var) @definition.var))
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
|
||||
(var) @reference
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
; Definitions
|
||||
(argument
|
||||
name: (identifier) @definition.parameter
|
||||
(set! "definition.var.scope" "local")
|
||||
(#set! "definition.var.scope" "local")
|
||||
)
|
||||
|
||||
(variable_definition
|
||||
|
|
@ -18,10 +18,10 @@
|
|||
|
||||
(variable_definition
|
||||
name: (variable (environment_var (identifier) @definition.var))
|
||||
(set! "definition.var.scope" "global"))
|
||||
(#set! "definition.var.scope" "global"))
|
||||
|
||||
(function_definition name: (variable) @definition.var
|
||||
(set! "definition.var.scope" "parent")
|
||||
(#set! "definition.var.scope" "parent")
|
||||
)
|
||||
|
||||
(identifier) @reference
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue