Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

TagFinder.findEndTag matches by substring, not exact tag names #394

Description

@sjuvonen

I am using the TagFinder class provided by this package in my own Atom package and have an issue with its behavior. Its method findEndTag() matches tag names by substring and will therefore result in false positives, messing up any attempt at proper tag matching.

Consider this snippet:

<foo-t>
  <foo-too></foo-too>
</foo-t>

If I execute TagFinder.findEndTag('foo-t', { row: 0, column: 7 }), the method will return 'foo-too', matching the wrong end tag on line 2, instead of the actual end tag on line 3.

Looking at how the regular expression for matching tags is written, this could even be intended behavior, as the regex is clearly written to allow any end tag that simply starts with the passed name. Therefore I don't provide any suggestions for patching this. At least it could be checked after the regex matching that captured tag name is an exact match and not a simple substring match.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions