Skip to content

Matchit support has problems with unclosed tags #152

@AndrewRadev

Description

@AndrewRadev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions