Regular expression syntax highlighting wrong?

Is it just me, or does the syntax highlighter do the wrong thing with Javascript regular expressions?  All mine are highlighted using the rule for "General | Injected language fragment" (whatever that is), rather than the rule for "Javascript | Regular expression".  Should I file a bug report?

On a related note, is there a way to point at something and have the editor tell you which highlighting rule it's using?


What problem do you have namely? Code sample would be helpful. Normally WebStorm injects javascript RegExp language into regular expressions.


I don't know what "WebStorm injects javascript RegExp language into regular expressions" means.

All I'm saying is that regular expression literals in Javascript, such as this:
are not being highlighted according to the settings for "Javascript | Regular expression".  If you're saying it's correct that WS is following the language injection rules, whatever that means, then why does WS even have a "Javascript | Regular expression" setting for syntax highlighting?


You need changing Settings/Editor/Colors&Fonts/General/Injected language fragment colors if you like your injected regexp to be highlighted in different way. Javascript | Regular expression settings only affect leading/trailing slashes color


That sounds a little like saying "the String setting only affects the color of the quotation marks".  But I see what you're saying, and it's actually nice that you do syntax highlighting within regular expression literals.  I'd just suggest that the Settings dialog is a little misleading -- when you go to Settings/Editor/Colors&Fonts/Javascript and click on "Regular expression", WS highlights the entire regular expression literal in the example box, and styles the entire literal with whatever you choose in the colors/effects part of the dialog.  So you can see why I might be confused about what setting to change.


Please sign in to leave a comment.