mickeynp / combobulate

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

Trying to remove <> tag in JSX removes wrong tag #10

Closed phuhl closed 1 year ago

phuhl commented 1 year ago

Hey there, just stumbled upon a bug:

When having this JSX

<body>
  <>
    <div>Test</div>
  </>
</body>

with the cursor before <>, then running combobulate-javascript-jsx-vanish-node does not remove the <> tags but the body tag.

I wonder how that happens, usually I'd say a malformed regex but as this is based on tree-sitter... 🤔

Cheers

mickeynp commented 1 year ago

Yeah this is a tricky one because it's definitely a bug, but the jsx_fragment type does not expose an open and close tag field like the other ones do. So I can't just add it to the vanish code checker. So I'll need to go back to the drawing board and come up with something more generic.

Thanks for reporting it.

Note also that combobulate only works with the external tree-sitter lib. It's due a massive refurb as Emacs 29 now includes TS but with very different bindings.

mickeynp commented 1 year ago

This is fixed in master.