Raimondi / delimitMate

Vim plugin, provides insert mode auto-completion for quotes, parens, brackets, etc.
http://www.vim.org/scripts/script.php?script_id=2754
1.98k stars 117 forks source link

Improper matching when inside a ' ' string inside a " " string inside a block (PHP) #101

Closed ehaughee closed 11 years ago

ehaughee commented 12 years ago

Sorry for the horrible title. I was trying to find a good way to state the issue.

Basically, I have the following block:

function test($array)
{
    $query = "SELECT something FROM atable WHERE acolumn = '{<cursor here>'";
} <--- HERE

When I hit } while the cursor is at the position denoted in the above code block, I am sent to the position marked with <--- HERE instead of the second brace being inserted.

After more testing, here is one case with the appropriate behavior and some without. All of the following lines of code are inside a block like the function test() block described above.

Single quotes nested inside of double quotes

It seems like if the left item of a match is typed inside of a string, and before the closing match of that string, everything works. However, if the left item of a match is typed, and the following character is not the closing match of the parent string, autocomplete goes a little haywire and, in the case of double quotes, balancing goes haywire as well.

Sorry for the rambling issue; I got interrupted a few times while writing it and stopped to do some additional testing. Let me know if you need any clarification. I will submit my delimitTest output if requested, but it should be identical to my output in my previous issue submission: https://github.com/Raimondi/delimitMate/issues/100

alexeymorozov commented 12 years ago

I have the same issue occured. :(

ehaughee commented 12 years ago

@rekky I ended up switching to Auto-Pairs. It is not as smart, but it doesn't have the same issues.

alexeymorozov commented 12 years ago

@ehaughee Thank you! Now I'm using it too.

Raimondi commented 11 years ago

This seems to be fixed. I can't reproduce the issues anymore.