mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-21 12:50:09 -04:00
feat: @constructor.call
This commit is contained in:
parent
0e21ee8df6
commit
fc6b77b443
15 changed files with 54 additions and 53 deletions
|
|
@ -156,7 +156,8 @@ As languages differ quite a lot, here is a set of captures available to you when
|
|||
@function.method ; method definitions
|
||||
@function.method.call ; method calls
|
||||
|
||||
@constructor ; constructor calls and definitions
|
||||
@constructor ; constructor definitions
|
||||
@constructor.call ; constructor calls
|
||||
@operator ; symbolic operators (e.g. `+` / `*`)
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -290,12 +290,12 @@
|
|||
"new"
|
||||
(call_expression
|
||||
.
|
||||
(identifier) @constructor))
|
||||
(identifier) @constructor.call))
|
||||
|
||||
((call_expression
|
||||
.
|
||||
(identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
(identifier) @constructor.call)
|
||||
(#lua-match? @constructor.call "^%u"))
|
||||
|
||||
; Attributes
|
||||
(decorator
|
||||
|
|
|
|||
|
|
@ -161,24 +161,24 @@
|
|||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
function: (identifier) @constructor.call)
|
||||
(#lua-match? @constructor.call "^%u"))
|
||||
|
||||
((call_expression
|
||||
function: (qualified_identifier
|
||||
name: (identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
name: (identifier) @constructor.call))
|
||||
(#lua-match? @constructor.call "^%u"))
|
||||
|
||||
((call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
field: (field_identifier) @constructor.call))
|
||||
(#lua-match? @constructor.call "^%u"))
|
||||
|
||||
; constructing a type in an initializer list: Constructor (): **SuperType (1)**
|
||||
((field_initializer
|
||||
(field_identifier) @constructor
|
||||
(field_identifier) @constructor.call
|
||||
(argument_list))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
(#lua-match? @constructor.call "^%u"))
|
||||
|
||||
; Constants
|
||||
(this) @variable.builtin
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@
|
|||
; Constructor
|
||||
;------------
|
||||
(new_expression
|
||||
constructor: (identifier) @constructor)
|
||||
constructor: (identifier) @constructor.call)
|
||||
|
||||
; Decorators
|
||||
;----------
|
||||
|
|
|
|||
|
|
@ -44,12 +44,12 @@
|
|||
|
||||
; Constructors
|
||||
((call_expression
|
||||
(identifier) @constructor)
|
||||
(#lua-match? @constructor "^[nN]ew.+$"))
|
||||
(identifier) @constructor.call)
|
||||
(#lua-match? @constructor.call "^[nN]ew.+$"))
|
||||
|
||||
((call_expression
|
||||
(identifier) @constructor)
|
||||
(#lua-match? @constructor "^[mM]ake.+$"))
|
||||
(identifier) @constructor.call)
|
||||
(#lua-match? @constructor.call "^[mM]ake.+$"))
|
||||
|
||||
; Operators
|
||||
[
|
||||
|
|
|
|||
|
|
@ -131,8 +131,8 @@
|
|||
|
||||
((call_expression
|
||||
.
|
||||
(identifier) @constructor)
|
||||
(#eq? @constructor "init"))
|
||||
(identifier) @constructor.call)
|
||||
(#eq? @constructor.call "init"))
|
||||
|
||||
; Parameters
|
||||
(parameter
|
||||
|
|
|
|||
|
|
@ -364,29 +364,29 @@
|
|||
; @constructor ; constructor calls and definitions
|
||||
(call
|
||||
function: [
|
||||
(identifier) @constructor
|
||||
(identifier) @constructor.call
|
||||
(accent_quoted
|
||||
(identifier) @constructor)
|
||||
(identifier) @constructor.call)
|
||||
; generic types
|
||||
(bracket_expression
|
||||
left: (identifier) @constructor)
|
||||
left: (identifier) @constructor.call)
|
||||
(bracket_expression
|
||||
left: (accent_quoted
|
||||
(identifier) @constructor))
|
||||
(identifier) @constructor.call))
|
||||
; dot accessor
|
||||
(dot_expression
|
||||
right: (identifier) @constructor)
|
||||
right: (identifier) @constructor.call)
|
||||
(dot_expression
|
||||
right: (accent_quoted
|
||||
(identifier) @constructor))
|
||||
(identifier) @constructor.call))
|
||||
; both
|
||||
(bracket_expression
|
||||
left: (dot_expression
|
||||
right: (identifier) @constructor))
|
||||
right: (identifier) @constructor.call))
|
||||
(bracket_expression
|
||||
left: (dot_expression
|
||||
right: (accent_quoted
|
||||
(identifier) @constructor)))
|
||||
(identifier) @constructor.call)))
|
||||
]
|
||||
(argument_list
|
||||
(colon_expression)+))
|
||||
|
|
|
|||
|
|
@ -113,8 +113,8 @@
|
|||
|
||||
; Constructors
|
||||
((message_expression
|
||||
method: (identifier) @constructor)
|
||||
(#eq? @constructor "init"))
|
||||
method: (identifier) @constructor.call)
|
||||
(#eq? @constructor.call "init"))
|
||||
|
||||
; Attributes
|
||||
(availability_attribute_specifier
|
||||
|
|
|
|||
|
|
@ -270,8 +270,8 @@
|
|||
(member_name) @function.call)
|
||||
|
||||
(invokation_expression
|
||||
(member_name) @constructor
|
||||
(#eq? @constructor "new"))
|
||||
(member_name) @constructor.call
|
||||
(#eq? @constructor.call "new"))
|
||||
|
||||
(member_access
|
||||
(member_name
|
||||
|
|
|
|||
|
|
@ -387,13 +387,13 @@
|
|||
attribute: (identifier) @function.method.call))
|
||||
|
||||
((call
|
||||
function: (identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
function: (identifier) @constructor.call)
|
||||
(#lua-match? @constructor.call "^%u"))
|
||||
|
||||
((call
|
||||
function: (attribute
|
||||
attribute: (identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
attribute: (identifier) @constructor.call))
|
||||
(#lua-match? @constructor.call "^%u"))
|
||||
|
||||
; Builtin functions
|
||||
((call
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@
|
|||
field: (identifier) @function.method.call))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @constructor)
|
||||
(#lua-match? @constructor "^[A-Z]"))
|
||||
function: (identifier) @constructor.call)
|
||||
(#lua-match? @constructor.call "^[A-Z]"))
|
||||
|
||||
(generic_function
|
||||
function: (identifier) @function.call)
|
||||
|
|
|
|||
|
|
@ -160,24 +160,24 @@
|
|||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
function: (identifier) @constructor.call)
|
||||
(#lua-match? @constructor.call "^%u"))
|
||||
|
||||
((call_expression
|
||||
function: (qualified_identifier
|
||||
name: (identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
name: (identifier) @constructor.call))
|
||||
(#lua-match? @constructor.call "^%u"))
|
||||
|
||||
((call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
field: (field_identifier) @constructor.call))
|
||||
(#lua-match? @constructor.call "^%u"))
|
||||
|
||||
; constructing a type in an initializer list: Constructor (): **SuperType (1)**
|
||||
((field_initializer
|
||||
(field_identifier) @constructor
|
||||
(field_identifier) @constructor.call
|
||||
(argument_list))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
(#lua-match? @constructor.call "^%u"))
|
||||
|
||||
; Constants
|
||||
(this) @variable.builtin
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@
|
|||
; Constructors
|
||||
(new_expression
|
||||
class: (identifier) @type
|
||||
arguments: (call_arguments) @constructor)
|
||||
arguments: (call_arguments) @constructor.call)
|
||||
|
||||
; Methodmaps
|
||||
(methodmap
|
||||
|
|
@ -119,7 +119,7 @@
|
|||
inherits: (identifier) @type)
|
||||
|
||||
(methodmap_method_constructor
|
||||
name: (identifier) @constructor)
|
||||
name: (identifier) @constructor.call)
|
||||
|
||||
(methodmap_method
|
||||
name: (identifier) @function.method)
|
||||
|
|
|
|||
|
|
@ -328,10 +328,10 @@
|
|||
attribute: (identifier) @function.method.call))
|
||||
|
||||
((call
|
||||
function: (identifier) @constructor)
|
||||
(#lua-match? @constructor "^[A-Z]"))
|
||||
function: (identifier) @constructor.call)
|
||||
(#lua-match? @constructor.call "^[A-Z]"))
|
||||
|
||||
((call
|
||||
function: (attribute
|
||||
attribute: (identifier) @constructor))
|
||||
(#lua-match? @constructor "^[A-Z]"))
|
||||
attribute: (identifier) @constructor.call))
|
||||
(#lua-match? @constructor.call "^[A-Z]"))
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@
|
|||
(symbol
|
||||
(symbol)? @keyword.import
|
||||
(identifier) @type)
|
||||
(identifier) @constructor)))
|
||||
(#lua-match? @constructor "^[%l][%l%d_]*$"))
|
||||
(identifier) @constructor.call)))
|
||||
(#lua-match? @constructor.call "^[%l][%l%d_]*$"))
|
||||
|
||||
(unqualified_type
|
||||
(symbol
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue