ghostbuster91 / nvim-next

Apache License 2.0
29 stars 6 forks source link

Cannot bind *tree-sitter* `goto_previous` #25

Closed stevenxxiu closed 2 months ago

stevenxxiu commented 2 months ago

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>
phanen commented 2 months ago

goto_previous -> goto_previous_start

stevenxxiu commented 2 months ago

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 50b639da68d9a132bac07c7e99a999a8ed47065f.

ghostbuster91 commented 2 months ago

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 https://github.com/ghostbuster91/nvim-next/commit/50b639da68d9a132bac07c7e99a999a8ed47065f.

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

stevenxxiu commented 2 months ago

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!