gandm / language-babel

ES2017, flow, React JSX and GraphQL grammar and transpilation for ATOM
https://atom.io/packages/language-babel
MIT License
476 stars 83 forks source link

Attributes on multiple lines breaks opening and closing tag highlighting #457

Closed phallwurst closed 6 years ago

phallwurst commented 6 years ago

Bug report. Forgive me if this has been reported already or if a fix was made but has not yet been released.

I have noticed this problem for a while now, but only just now discovered what I believe to be the cause. When I have a div whose attributes are declared on multiple lines, the highlighting for corresponding opening and closing tags does not highlight the correct components.

In the below screenshot, my cursor is on the opening tag line of the innermost div, whose attributes are declared on multiple lines. In this screenshot, the opening and closing tag highlighting is correct.

screen shot 2017-11-30 at 3 22 50 pm

In this screenshot, I have moved my cursor to the opening tag of the div that is one level above the innermost div. However, you can see that the highlighted closing tag still corresponds to the closing tag of the innermost div. If i place my cursor on the closing tag of the outermost div, it does not highlight anything.

screen shot 2017-11-30 at 3 23 13 pm

In the below two screenshots, I have removed the id attribute from the innermost div so that the attributes no longer span multiple lines. As you can see, the opening and closing tag highlighting is now correct.

screen shot 2017-11-30 at 3 23 25 pm

screen shot 2017-11-30 at 3 23 36 pm

This is probably a fairly minor issue, but it can get a little confusing when the opening and closing tag highlighting doesn't match up properly. I don't know for sure if this is limited to just div elements, but I have only seen it with them. That is probably just because div elements are most commonly nested like this. I hope this helps.

gandm commented 6 years ago

Yes it has been reported before https://github.com/gandm/language-babel/issues/436 https://github.com/gandm/language-babel/issues/327 etc The matching isn't done by this package. It is actually a bug with https://github.com/atom/bracket-matcher