diff options
| author | Stephan Seitz <stephan.seitz@fau.de> | 2020-07-18 19:25:06 +0200 |
|---|---|---|
| committer | Thomas Vigouroux <39092278+vigoux@users.noreply.github.com> | 2020-07-20 08:55:53 +0200 |
| commit | 58c6d2a73fa40e2ad2e6f41215737d6ff27c4bf9 (patch) | |
| tree | 08457d3911ea77ba4cc70694a54416d17ba33a0f /queries | |
| parent | bash: add locals.scm for use with definition highlighting (diff) | |
| download | nvim-treesitter-58c6d2a73fa40e2ad2e6f41215737d6ff27c4bf9.tar nvim-treesitter-58c6d2a73fa40e2ad2e6f41215737d6ff27c4bf9.tar.gz nvim-treesitter-58c6d2a73fa40e2ad2e6f41215737d6ff27c4bf9.tar.bz2 nvim-treesitter-58c6d2a73fa40e2ad2e6f41215737d6ff27c4bf9.tar.lz nvim-treesitter-58c6d2a73fa40e2ad2e6f41215737d6ff27c4bf9.tar.xz nvim-treesitter-58c6d2a73fa40e2ad2e6f41215737d6ff27c4bf9.tar.zst nvim-treesitter-58c6d2a73fa40e2ad2e6f41215737d6ff27c4bf9.zip | |
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.
Diffstat (limited to 'queries')
| -rw-r--r-- | queries/c/locals.scm | 3 | ||||
| -rw-r--r-- | queries/cpp/locals.scm | 7 | ||||
| -rw-r--r-- | queries/rust/locals.scm | 6 |
3 files changed, 12 insertions, 4 deletions
diff --git a/queries/c/locals.scm b/queries/c/locals.scm index ee052d5c0..a288e70e4 100644 --- a/queries/c/locals.scm +++ b/queries/c/locals.scm @@ -31,7 +31,8 @@ ;; References (identifier) @reference -(type_identifier) @reference.type +((type_identifier) @reference + (set! reference.kind "type")) ;; Scope [ diff --git a/queries/cpp/locals.scm b/queries/cpp/locals.scm index b85e5f9e8..69d2f2c26 100644 --- a/queries/cpp/locals.scm +++ b/queries/cpp/locals.scm @@ -23,12 +23,17 @@ (alias_declaration name: (type_identifier) @definition.type) +;template <typename T> +(type_parameter_declaration + (type_identifier) @definition.type) + ;; Namespaces (namespace_definition name: (identifier) @definition.namespace body: (_) @scope) -(namespace_identifier) @reference.namespace +((namespace_identifier) @reference + (set! reference.kind "namespace")) ;; Function defintions (template_function diff --git a/queries/rust/locals.scm b/queries/rust/locals.scm index 1b372ed9d..010bf4afd 100644 --- a/queries/rust/locals.scm +++ b/queries/rust/locals.scm @@ -70,8 +70,10 @@ ; References (identifier) @reference -(type_identifier) @reference.type -(field_identifier) @reference.field +((type_identifier) @reference + (set! reference.kind "type")) +((field_identifier) @reference + (set! reference.kind "field")) ; Macros |
