-1

I am using Webstorm 7.0.3 to develop Node.Js. I have used Webstorm successfully for Html/Js apps, but for whatever reason, the code-coloring and error-highlighting does not exist in my Node.Js app that does for my Html/Js. For example, simple syntax errors don't highlight as desired.

You can see the difference in the two:

Html formatting:

Html Formatting

Node Formatting:

Node Formatting

While I know this is not a super critical thing, it makes it hard to debug as I code. Anyone know why it's different? I've searched Webstorms, but couldn't find anything.

Thanks in advance!

JBalzer
  • 105
  • 6
  • works fine for me. seems your .js file is not recognized as javascript for some reason (whereas the javascript embedded in – lena Mar 03 '14 at 17:17
  • Invalidating the caches did not work, however, your question brought up a good point: this problem is only existent in the node-modules folder. Javascript files in other folders format correctly. Not sure why that would happen, though. – JBalzer Mar 03 '14 at 17:43
  • Possible duplicate: http://stackoverflow.com/questions/12705538/how-to-configure-webstorm-phpstorm-project-so-that-js-code-intelligence-works – heyheyjp Mar 03 '14 at 18:08
  • @prattsj: that certainly seems like a similar post, and I tried a few of the ideas on that page out to no avail. That post seems more to do with code completion (which works decently for me), not with code formatting and syntax/error high-lighting. – JBalzer Mar 03 '14 at 21:08

2 Answers2

0

Most likely the node_modules folder is added to javascript libraries (WebStorm prompts you to configure a library on project opening). Javascript files in libraries have the inspections and error/syntax highlighting turned off by default. You can still enable them for particular file using the Hector icon in the lower right corner (http://www.jetbrains.com/webstorm/webhelp/changing-highlighting-level-for-the-current-file.html)

lena
  • 90,154
  • 11
  • 145
  • 150
  • yep, looks like that's the solution, although seems to be one file at a time. Thanks for the help! – JBalzer Mar 04 '14 at 15:56
-1

You can change your formatting this way:

var A = { foo: 'bar'
        , forgotThatComma: false
        }

So if you ever miss a comma, it would be obvious (see npm style guide for details).

alex
  • 11,935
  • 3
  • 30
  • 42