Update gdscript queries (#4405)

* locals(gdscript): update locals

* folds(gdscript): add folds

* indents(gdscript): update indents with notes

* highlights(gdscript): update highlights

* docs(gdscript): add gdscript maintainer

* indents(gdscript): add ERROR auto indent

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>

* highlights(gdscript): use text.uri for get_node and node_path

* highlights(gdscript): add "@" of annotation as attribute

* highlights(gdscript): use keyword.operator for "new", match all attribute_call

* highlights(gdscript): update (underscore) and (pattern_open_ending)

---------

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
This commit is contained in:
Preston Knopp 2023-03-01 23:28:13 -08:00 committed by GitHub
parent b145021499
commit 36b1038a65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 412 additions and 35 deletions

View file

@ -1,10 +1,92 @@
(function_definition) @definition.function
;; Scopes
[
(extends_statement)
(variable_statement)
(expression_statement)
(if_statement)
(elif_clause)
(else_clause)
(for_statement)
(while_statement)
(function_definition)
(body)
(constructor_definition)
(class_definition)
(match_statement)
(pattern_section)
(lambda)
(get_body)
(set_body)
] @scope
;; Parameters
(parameters (identifier) @definition.parameter)
(default_parameter (identifier) @definition.parameter)
(typed_parameter (identifier) @definition.parameter)
(typed_default_parameter (identifier) @definition.parameter)
;; Signals
; Can gdscript 2 signals be considered fields?
(signal_statement (name) @definition.field)
;; Variable Definitions
(const_statement (name) @definition.constant)
; onready and export variations are only properties.
(variable_statement (name) @definition.var)
(setter) @reference
(getter) @reference
;; Function Definition
((function_definition (name) @definition.function)
(#set! "definition.function.scope" "parent"))
;; Lambda
; lambda names are not accessible and are only for debugging.
(lambda (name) @definition.function)
;; Source
(class_name_statement (name) @definition.type)
(source (variable_statement (name) @definition.field))
(source (onready_variable_statement (name) @definition.field))
(source (export_variable_statement (name) @definition.field))
;; Class
((class_definition (name) @definition.type)
(#set! "definition.type.scope" "parent"))
(class_definition
(body (variable_statement (name) @definition.field)))
(class_definition
(body (onready_variable_statement (name) @definition.field)))
(class_definition
(body (export_variable_statement (name) @definition.field)))
(class_definition
(body (signal_statement (name) @definition.field)))
; Although a script is also a class, let's only define functions in an inner class as
; methods.
((class_definition
(body (function_definition (name) @definition.method)))
(#set! "definition.method.scope" "parent"))
;; Enum
((enum_definition (name) @definition.enum))
;; Repeat
(for_statement . (identifier) @definition.var)
;; Match Statement
(pattern_binding (identifier) @definition.var)
;; References
(identifier) @reference