mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-05 21:10:15 -04:00
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.
45 lines
1.1 KiB
Scheme
45 lines
1.1 KiB
Scheme
;; Functions definitions
|
|
(function_declarator
|
|
declarator: (identifier) @definition.function)
|
|
(preproc_function_def
|
|
name: (identifier) @definition.macro) @scope
|
|
|
|
(preproc_def
|
|
name: (identifier) @definition.macro)
|
|
(pointer_declarator
|
|
declarator: (identifier) @definition.var)
|
|
(parameter_declaration
|
|
declarator: (identifier) @definition.var)
|
|
(init_declarator
|
|
declarator: (identifier) @definition.var)
|
|
(array_declarator
|
|
declarator: (identifier) @definition.var)
|
|
(declaration
|
|
declarator: (identifier) @definition.var)
|
|
(enum_specifier
|
|
name: (_) @definition.type
|
|
(enumerator_list
|
|
(enumerator name: (identifier) @definition.var)))
|
|
|
|
;; Type / Struct / Enum
|
|
(field_declaration
|
|
declarator: (field_identifier) @definition.field)
|
|
(type_definition
|
|
declarator: (type_identifier) @definition.type)
|
|
(struct_specifier
|
|
name: (type_identifier) @definition.type)
|
|
|
|
;; References
|
|
(identifier) @reference
|
|
((type_identifier) @reference
|
|
(set! reference.kind "type"))
|
|
|
|
;; Scope
|
|
[
|
|
(for_statement)
|
|
(if_statement)
|
|
(while_statement)
|
|
(translation_unit)
|
|
(function_definition)
|
|
(compound_statement) ; a block in curly braces
|
|
] @scope
|