subtleGradient / language-javascript-jsx

JavaScript with JSX Bundle for Atom
45 stars 6 forks source link

Code coloring problem with a RegExp ending with a / after an || #34

Open erikras opened 7 years ago

erikras commented 7 years ago

The javascript coloring is being thrown off by an escaped / at the end of a regular expression.

const addProtocol = (url: string): string =>
    (!url || /^https?:\/\//.test(url) ? url : `http://${url}`)

regexp

Interestingly, if you remove the !url || before the RegExp, it works fine. Something about the || is throwing it off.

More info: https://github.com/facebook/nuclide/issues/1121