ziontee113 / syntax-tree-surfer

A plugin for Neovim that helps you surf through your document and move elements around using the nvim-treesitter API.
MIT License
469 stars 9 forks source link

Allow mappings to queries from nvim-treesitter-textobjects? #5

Open davidatsurge opened 2 years ago

davidatsurge commented 2 years ago

First off, thanks a bunch for working on this plugin! I absolutely love the possibilities that neovim's treesitter integration opens up, and it's great when you find a plugin that you were thinking that you'd have to code yourself 😂.

Soo, the nvim-treesitter-textobjects plugin has a set of cross-filetype definitions for textobjects/move targets, as summarized here. I was wondering if you'd be interested in allowing syntax-tree-surfer to use these definitions (like @function.outer, .. etc) to define jump targets. I know that syntax-tree-surfer also has other features like swapping and moving, and I don't see anything that prevents these definitions being used there as well, but I am really interested in jumping (like here ).

The advantage of using the definitions from nvim-treesitter-textobjects is that we build upon the work did there to define a consistent definition of a function/ a class/an if statement/..etc across many files.

ziontee113 commented 2 years ago

That is a great idea. Although I’m not familiar with that area of treesitter (will need to learn). It will take some time but if it makes life easier for people, I’ll try to implement it.

ziontee113 commented 2 years ago

I’m curious, how would you / other people you use such a feature?