React component files not indexing or highlighting properly.

I cannot figure out how to get PhpStorm to correctly index and syntax highlight my React component files. The JSX markup is highlighting properly, but all JavaScript code remains colorless.

I have them in a directory called 'src' and it is not in the same path location as my webpack configuration. Therefore it should not be ignored by default. There are small 'x' icons in the sidebar for these JS files denoting they are being disregarded in some way or another.

 

Can anyone enlighten me on how to get these to be properly highlighted?

0
2 comments

Please check your .idea/workspace.xml - do you have these .js files listed in <component name="TypeScriptGeneratedFilesManager"> section there, like:

<component name="TypeScriptGeneratedFilesManager">
    <option name="version" value="1" />
    <option name="exactExcludedFiles">
      <list>
        <option value="$PROJECT_DIR$/path/to/your/file.js" />
        ...
      </list>
    </option>
  </component>

If it's not there, please try invalidating caches (File | Invalidate caches, Invalidate and restart) - does the issue persist?

0

Elena, thank you for your reply.

Actually, I figured it out only moments ago. My workspace config was fine, but under:

Preferences > Directories

*.js was in the "Exclude files" input field (at the bottom). I don't understand how this happened, because I certainly didn't insert in manually. But after I removed *.js from the "Exclude files" field, indexing and highlighting now work as they should.

1

Please sign in to leave a comment.