Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function declaration's closing bracket highlighted as error #1225

Open
andresrodco opened this issue Dec 24, 2020 · 1 comment
Open

Function declaration's closing bracket highlighted as error #1225

andresrodco opened this issue Dec 24, 2020 · 1 comment

Comments

@andresrodco
Copy link

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:

  • This happens in a .js file.
  • This happens to the closing bracket of a function declaration. Doesn't matter if it's exported or not.
  • This happens only when inside that function there's a nested object destructuring statement AND any of the keys but the last one is surrounded by quotes, either single, double, or backticks (see images above).
  • The result of SyntaxAttr for that closing bracket is group: jsParensError->Error guifg=255(255) guibg=203(203), which is declared in the syntax/javascript.vim file.
  • I'm using Vim Polyglot with no additional configuration for javascript files.
@yusuphgammut
Copy link

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.

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

No branches or pull requests

2 participants