mickeynp / combobulate

Structured Editing and Navigation in Emacs with Tree-Sitter
GNU General Public License v3.0
945 stars 54 forks source link

Move inside empty node #9

Closed phuhl closed 1 year ago

phuhl commented 1 year ago

Hi, this package is great stuff. Just starting to use it.

I noticed one usecase that seems unsupported (or I just didn't find it?): Moving into an empty node, eg.:

<div></div>

The cursor is before the div and I want to insert something into it. Using combobulate-navigate-down refuses to go in, as there is no node in there.

Cheers

mickeynp commented 1 year ago

The reason is that the node type jsx_text is not in the combobulate-navugation-node-types list. The reason it's not is... hard to justify, possibly, but adding it creates another problem: every node node has jsx_text even if the text is the empty string!

So if you add update that list in combobulate-javascript.el then you'll be able to navigate, but it'd also consider jsx_text elements to be sibling nodes of other nodes, which has unintended consequences. So it's a bit of a pickle. Combobulate should instead allow you to go down into an inner-most node using some other method.

phuhl commented 1 year ago

Thanks for the info, I'll play around with combobulate-navugation-node-types and see how it behaves

mickeynp commented 1 year ago

Ok so this is now actually fixed properly in the new version of combobulate. Can you try development? A lot has changed.