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

How do you get the AST highlighted in visual mode like in the demo video? #16

Closed llllvvuu closed 1 year ago

llllvvuu commented 1 year ago

https://github.com/ziontee113/syntax-tree-surfer#navigate-around-your-document-based-on-treesitters-abstract-syntax-tree-step-into-step-out-step-over-step-back it's show when random_array is highlighted

Mine just looks like this:

https://github.com/ziontee113/syntax-tree-surfer/assets/5601392/25b7782c-797e-44bb-9214-349d0e64f10f

ziontee113 commented 1 year ago

You can use


-- Visual Selection from Normal Mode
vim.keymap.set("n", "vx", '<cmd>STSSelectMasterNode<cr>', opts)
vim.keymap.set("n", "vn", '<cmd>STSSelectCurrentNode<cr>', opts)```

to achieve that.
llllvvuu commented 1 year ago

So it's supposed to show the AST indicators when pressing vn but not when pressing V?

Even with STSSelectCurrentNode I got only the selection/range but not the AST indicators. Do you know which part is repsonsible for those indicators?

I couldn't find it here: https://github.com/ziontee113/syntax-tree-surfer/blob/8b707abc887379468086a4774b5d1a233d69b0c7/lua/syntax-tree-surfer/init.lua#L51-L64

EDIT: maybe just the colorscheme need to set bgcolor, let me try...

llllvvuu commented 1 year ago

OK, I figured it out, it's a feature of gruvbox: https://github.com/gruvbox-community/gruvbox/issues/126