luochen1990 / rainbow

Rainbow Parentheses Improved, shorter code, no level limit, smooth and fast, powerful configuration.
Apache License 2.0
1.78k stars 95 forks source link

[Bug] An edge case when using JS regex #157

Closed tejasvi closed 3 years ago

tejasvi commented 3 years ago

Describe the bug

Incorrect color coding.

To Reproduce

File: bug.js, filetype=javascript

data.replaceAll(/[\\\/:*?"<>|]/g, '-')

Steps:

  1. Open file via vim bug.js
  2. See the color of outermost ( and )

Expected behavior

The color should be same.

Screenshots

image

luochen1990 commented 3 years ago

It seems that your javascript syntax plugin doesn't recognize the /regex/ syntax, or doesn't handle it correctly, so that the " is not wrapped by / and be recognized as beginning of string literal

tejasvi commented 3 years ago

That explains it then. I am using Vim's inbuilt JS syntax implementation. % is not working correctly as well. Anyway, thanks for pointer!