Improve Python queries, add locals (#3284)

pull/3295/head^2
ChrHorn 2 years ago committed by GitHub
parent 0c08ff1596
commit 11367488ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,5 +1,10 @@
; Imports
(dotted_name (dotted_name
(identifier)* @namespace) (identifier)* @namespace)
(aliased_import
alias: (identifier) @namespace)
; Builtin functions ; Builtin functions
@ -55,7 +60,6 @@
(parameters (typed_parameter (identifier) @variable.parameter)) (parameters (typed_parameter (identifier) @variable.parameter))
(parameters (default_parameter name: (identifier) @variable.parameter)) (parameters (default_parameter name: (identifier) @variable.parameter))
(parameters (typed_default_parameter name: (identifier) @variable.parameter)) (parameters (typed_default_parameter name: (identifier) @variable.parameter))
(keyword_argument name: (identifier) @variable.parameter)
(parameters (parameters
(list_splat_pattern ; *args (list_splat_pattern ; *args
@ -63,6 +67,9 @@
(parameters (parameters
(dictionary_splat_pattern ; **kwargs (dictionary_splat_pattern ; **kwargs
(identifier) @variable.parameter)) (identifier) @variable.parameter))
(lambda_parameters
(identifier) @variable.parameter)
; Types ; Types

@ -0,0 +1,44 @@
;; Scopes
[
(module)
(function_definition)
(lambda)
] @local.scope
;; Definitions
; Parameters
(parameters
(identifier) @local.definition)
(parameters
(typed_parameter
(identifier) @local.definition))
(parameters
(default_parameter
name: (identifier) @local.definition))
(parameters
(typed_default_parameter
name: (identifier) @local.definition))
(parameters
(list_splat_pattern ; *args
(identifier) @local.definition))
(parameters
(dictionary_splat_pattern ; **kwargs
(identifier) @local.definition))
(lambda_parameters
(identifier) @local.definition)
; Imports
(import_statement
name: (dotted_name
(identifier) @local.definition))
(aliased_import
alias: (identifier) @local.definition)
;; References
(identifier) @local.reference
Loading…
Cancel
Save