pangloss / vim-javascript

Vastly improved Javascript indentation and syntax support in Vim.
http://www.vim.org/scripts/script.php?script_id=4452
3.79k stars 357 forks source link

Function declaration's closing bracket highlighted as error #1225

Open andresrodco opened 3 years ago

andresrodco commented 3 years ago

When any but the last destructuring key is surrounded by quotes, the error occurs:

Screen Shot 2020-12-24 at 10 40 52

When any but the last destructuring key is NOT surrounded by quotes, the highlight is ok:

Screen Shot 2020-12-24 at 10 42 31

I've managed to research a little bit the issue and this is what I found:

yusuphgammut commented 3 years ago

I think I found a fix.

We need to create a new region called jsDestructuringPropertyString and include it in the contains attribute of the jsDestructuringBlock region.

The new jsDestructuringPropertyString should be:

syntax region  jsDestructuringPropertyString    contained matchgroup=jsObjectKeyString     start=+\z(["']\)+  skip=+\\\%(\z1\|$\)+  end=+\z1\|$+  contains=jsSpecial skipwhite skipempty nextgroup=jsObjectValue

I'll see if I can create a PR for that.