atom / bracket-matcher

Jump to brackets
MIT License
142 stars 98 forks source link

Closely-named XML tags are not matched correctly using vue grammar #392

Open jonboiser opened 4 years ago

jonboiser commented 4 years ago

Prerequisites

Description

Hi, the issue might be due to the internal workings of the language-vue, but maybe you can help me understand the internals of this library so I can try to patch language-vue.

When using the Tree-Sitter HTML grammar, the tag matching works properly:

Screen Shot 2020-01-22 at 12 22 43 PM

But when I switch the (non-Tree Sitter) grammar to the "Vue component" text.html.vue, the VCard start tag is being matched with the inner VCardTitle end tag:

Screen Shot 2020-01-22 at 12 23 07 PM

Does 'bracket-matcher' internally rely on the grammar scope names to find the pairs?

I've added the scopes for the highlighted tags on both screenshots to show that there is a slight difference in the Vue scopes. It is also reminiscent of the various nested-tag bugs reported before (e.g. #320 )

Steps to Reproduce

  1. Write a Vue Component-like text file like this
<VCard>
  <VCardTitle>
  </VCardTitle>
</VCard>
  1. In Atom, with both the language-vue and bracket-matcher libraries installed, view the file using the 'Vue Component' syntax
  2. The wrong bracket will be matched when the cursor is on the first line "VCard"

Expected behavior:

For this example, the first "VCard" tag is matched with the second on line 4.

Actual behavior:

For this example, the first "VCard" tag is matched with the "VCardTitle" tag on line 3.

Reproduces how often:

Always

Versions

apm  2.4.3
npm  6.2.0
node 10.2.1 x64
atom 1.43.0
python 3.7.5
git 2.21.1

MacOS Catalina

Additional Information