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

Close tag is not working properly on nested elements #320

Open
1 task done
ahshum opened this issue Oct 9, 2017 · 4 comments
Open
1 task done

Close tag is not working properly on nested elements #320

ahshum opened this issue Oct 9, 2017 · 4 comments

Comments

@ahshum
Copy link

ahshum commented Oct 9, 2017

Prerequisites

Description

Using bracket-matcher:close-tag to close tag on nested elements is not working properly

Steps to Reproduce

  1. Example code
<div>
  <span>
    <div>
  </span>
</div>
  1. call bracket-matcher:close-tag on the 2nd div

Expected behavior: insert a </div> tag

Actual behavior: nothing happened

Reproduces how often: 100%

Versions

Atom : 1.21.0
Electron: 1.6.9
Chrome : 56.0.2924.87
Node : 7.4.0


Added by @rsese:

Additional Information

From @fauxparse #79 (comment)

The following code will reproduce it:

<div>
  <span>
    <div> |
  </span>
</div>

If the outer tags are all closed, attempting to close the inner div tag will do nothing. Interestingly, if the name of the outer tag has the same prefix as the one you're trying to close (e.g. divine), it also won't work.

This was erroneously reported as a bug in a package I wrote, close-tags (fauxparse/close-tags#2), because at some point bracket-matcher started stealing the alt-cmd-. keystroke for its own nefarious (and, it seems, broken) purposes, so I'm going to take a shot at fixing bracket-matcher. In the meantime, I have an override in my keymap to use close-tags, which does work, although I understand I may sound a little biased when I say so 😉

@karakunai
Copy link

karakunai commented Nov 1, 2017

I can confirm this, and it's been around for a long time.

Also happening with nested <section>.

In my case <div> will only trigger the problem when I got more than 3 <div> parent, somewhere between 4 to 7 and more. But <section> can trigger this in less than 4.

@karakunai
Copy link

And it also happens in my computer with Windows 7 x86 SP1, but now I'm using a laptop with Solus (Linux). The atom version is always the fresh (latest stable).

@karakunai
Copy link

What I can see is that the bracket matcher treat the closing bracket of the parent one as the closing bracket, where it shouldn't happen as it is one level higher than the one your'e just typing.

@rsese
Copy link

rsese commented Dec 6, 2017

It does look like this has been around for a while, referenced here:

#79

I'm going to go ahead and close that one in favor of this issue since the template is filled out with steps to reproduce.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants