CKolkey / ts-node-action

Neovim Plugin for running functions on nodes.
359 stars 20 forks source link

feat: expand / collapse html like tag #62

Closed mikavilpas closed 5 months ago

mikavilpas commented 7 months ago

Hi! I did some afternoon coding and implemented a fun feature for myself. I was wondering if you think this is something that could be included in ts-node-action itself.

Here is a demo:

https://github.com/CKolkey/ts-node-action/assets/300791/d076f9a7-8ee6-4739-969f-21b91aaae3f8

If you think this might be a good addition, I might have the time to open a PR for further discussion.

Thanks!

mikavilpas commented 7 months ago

Just added support for more languages that I use, now it works in html, jsx and tsx.

The code is available here https://github.com/mikavilpas/dotfiles/blob/2ebff88d93a78e665804abcb9672a5197b4701c1/.config/nvim/lua/plugins/ts-node-action.lua#L3-L113

Let me know if you'd like a PR, I can do some cleanup before that.

CKolkey commented 5 months ago

Looks cool, but that isn't valid HTML 😅 The parser is just very fault tolerant.

mikavilpas commented 5 months ago

Looks like I was wrong about html5 and it doesn't allow self closing tags like this. That's fair.

Do you think they would still be useful for jsx and tsx, though?

CKolkey commented 5 months ago

Yeah, we just had a whole talk about this at work. I was also wrong, haha.

As for jsx/tsx, sure, don't see why not :)