mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-14 09:20:04 -04:00
Attach kind of reference to query result instead of using subfields
This makes smart_rename work also for types out of the box and we don't need to search for the path of actual node.
This commit is contained in:
parent
45a1c3998d
commit
58c6d2a73f
3 changed files with 12 additions and 4 deletions
|
|
@ -31,7 +31,8 @@
|
||||||
|
|
||||||
;; References
|
;; References
|
||||||
(identifier) @reference
|
(identifier) @reference
|
||||||
(type_identifier) @reference.type
|
((type_identifier) @reference
|
||||||
|
(set! reference.kind "type"))
|
||||||
|
|
||||||
;; Scope
|
;; Scope
|
||||||
[
|
[
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,17 @@
|
||||||
(alias_declaration
|
(alias_declaration
|
||||||
name: (type_identifier) @definition.type)
|
name: (type_identifier) @definition.type)
|
||||||
|
|
||||||
|
;template <typename T>
|
||||||
|
(type_parameter_declaration
|
||||||
|
(type_identifier) @definition.type)
|
||||||
|
|
||||||
;; Namespaces
|
;; Namespaces
|
||||||
(namespace_definition
|
(namespace_definition
|
||||||
name: (identifier) @definition.namespace
|
name: (identifier) @definition.namespace
|
||||||
body: (_) @scope)
|
body: (_) @scope)
|
||||||
|
|
||||||
(namespace_identifier) @reference.namespace
|
((namespace_identifier) @reference
|
||||||
|
(set! reference.kind "namespace"))
|
||||||
|
|
||||||
;; Function defintions
|
;; Function defintions
|
||||||
(template_function
|
(template_function
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,10 @@
|
||||||
|
|
||||||
; References
|
; References
|
||||||
(identifier) @reference
|
(identifier) @reference
|
||||||
(type_identifier) @reference.type
|
((type_identifier) @reference
|
||||||
(field_identifier) @reference.field
|
(set! reference.kind "type"))
|
||||||
|
((field_identifier) @reference
|
||||||
|
(set! reference.kind "field"))
|
||||||
|
|
||||||
|
|
||||||
; Macros
|
; Macros
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue