nvim-treesitter / nvim-treesitter-textobjects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extending textobjects doesn't work

karangb opened this issue · comments

Describe the bug
Extending a textobjects.scm doesn't work. Only if I remove the textobject.scm from the plugin, the textobjects work.

To Reproduce
So let's say I want to extend the textobjects for the hack language.

Steps to reproduce the behavior:

  1. Write a textobjects.scm and put it in ~/.config/nvim/queries/hack/textobjects.scm
  2. Add a query as follows
; extends
(function_definition) @custom_capture
  1. Add it in the keymaps
  2. Attempt to select the custom text object using the keymaps -> doesn't work
  3. BUT, if I then delete .../plugged/nvim-treesitter-textobjects/queries/hack/textobjects.scm - repeating point 4 works

Expected behavior
In the scenario above, step 4 should work

Output of :checkhealth nvim-treesitter

nvim-treesitter: require("nvim-treesitter.health").check()
========================================================================
## Installation
  - ERROR: Nvim-treesitter requires Neovim 0.8.3+
  - WARNING: `tree-sitter` executable not found (parser generator, only needed for :TSInstallFromGrammar, not required for :TSInstall)
  - OK: `node` found v16.14.2 (only needed for :TSInstallFromGrammar)
  - OK: `git` executable found.
  - OK: `cc` executable found. Selected from { vim.NIL, "cc", "gcc", "clang", "cl", "zig" }
    Version: cc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-18)
  - OK: Neovim was compiled with tree-sitter runtime ABI version 14 (required >=13). Parsers must be compatible with runtime ABI.
## Parser/Features         H L F I J
  - hack                ✓ . . . .
  - query               ✓ ✓ ✓ ✓ ✓

  Legend: H[ighlight], L[ocals], F[olds], I[ndents], In[j]ections
         +) multiple parsers found, only one will be used
         x) errors found in the query, try to run :TSUpdate {lang}


**Output of `nvim --version`**

NVIM v0.8.0

You need to put it in ~/.config/nvim/after/queries/hack/textobjects.scm

Notice that you need the after directory.