ghostbuster91/nvim-next

Cannot bind *tree-sitter* `goto_previous`

Closed this issue · 4 comments

When I try to bind tree-sitter goto_previous:

opts = {
  -- ...
  nvim_next = {
    enable = true,
    textobjects = {
      move = {
        -- ...
        goto_previous = {
          ['[l'] = '@conditional.outer',
        },
      },
    },
  },
},

I get:

E5108: Error executing lua: ...xt/lua/nvim-next/integrations/treesitter-textobjects.lua:65: attempt to call a nil value
stack traceback:
    ...xt/lua/nvim-next/integrations/treesitter-textobjects.lua:65: in function <...xt/lua/nvim-next/integrations/treesitter-textobjects.lua:63>

goto_previous -> goto_previous_start

These aren't the same. Look at https://github.com/nvim-treesitter/nvim-treesitter-textobjects/tree/fe3deb7f67ce0cc4ebfe2ea6c1c7ae1c7a939d73?tab=readme-ov-file#text-objects-move:

-- Below will go to either the start or the end, whichever is closer.
-- Use if you want more granular movements
-- Make it even more gradual by adding multiple queries and regex.
goto_next = {

This worked before the commit 50b639d.

I reproduced the issue. Turned out I made a mistake in the treesitter method name. Should be fixed by now. Can you try the latest main branch?

This worked before the commit 50b639d.

Hmm, I don't think it could ever worked.

I guess you're right. I didn't test next as thoroughly as it did now.

It seems to work now. Thanks for the fix!