auto-pairs icon indicating copy to clipboard operation
auto-pairs copied to clipboard

auto-pairs doesn't detect imbalanced pairs

Open MisterTicot opened this issue 5 years ago • 2 comments

In a situation like this:

if (x) {
  if (y) {
    |
}

Pressing } will jump to the last bracket rather than inserting one. I think it should detect that pair are imbalanced and insert a closing bracket instead.

MisterTicot avatar Oct 03 '19 02:10 MisterTicot

Another example that I find myself quite often in is this:

echo "$|array[@]}"  # need to add `{`

or

echo |$[array[@]}"  # need to add `"`

nkakouros avatar Nov 21 '19 15:11 nkakouros

yes, in it's current state this feature is unusable because I almost always want to add closing brace, because it's missing or otherwise I wouldn't be pressing it. I found that you can use let g:AutoPairsMultilineClose = 0 to disable this, but then you loose this feature entirely, even when it makes sense. It's a trade off. I find it better disabled

If AutoPairs plugin did some scope analysis it could support this feature in a sane way, otherwise it's just silly how it behaves. I haven't found other plugin that does this well.

mversic avatar Apr 16 '20 10:04 mversic