CKolkey / ts-node-action

Neovim Plugin for running functions on nodes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Run Node Actions in embedded code

matthias-Q opened this issue · comments

Feature request:
So node actions are activated by filetype and not by the embedded code. I have SQL embedded in Julia/R and different languages embedded in Markdown. Would be nice to have the possibility to use node actions there as well.

Just perusing the help docs for treesitter, I don't see a way to get the name of the parser for the node under the cursor, but that's all you would need to do this. Seems like you can use vim.treesitter.get_parser(0):language_for_range({ ... }):lang() to get that, where the { ... } is a range for the current node.

It should be possible. When you have treesitter-playground, you can get the name of the parser that is used for this section.

Nice, works like a charm. Thank you!