vim-jsx-pretty icon indicating copy to clipboard operation
vim-jsx-pretty copied to clipboard

Matchit support has problems with unclosed tags

Open AndrewRadev opened this issue 4 years ago • 0 comments

Here's an example that fails for me on the current master:

const foo = <Foo>
  <FooBar />
</Foo>

Putting the cursor on the opening <Foo>, tapping % doesn't jump to the closing one, because between them there's this self-closed tag that starts with <Foo.

While there might be a fix to the pattern, I feel like a perfectly valid choice is to remove the matchit words, since Vim's runtime files seem to include one already: https://github.com/vim/vim/blob/a91871262670f9d3a4e5d1c5c6dbc02f85625f7d/runtime/ftplugin/javascript.vim#L52-L58

This is probably relatively recent -- I'm guessing that jsx-pretty provided support before Vim did, but maybe it's time to retire it? Or you could consider porting it here for older Vim installations. Admittedly, I'm not 100% sure it works correctly in all cases, but at least for this one it seems to do the trick.

AndrewRadev avatar Aug 30 '21 17:08 AndrewRadev