Several Javascript files marked with X and yellow background
I have a project and today, I suddenly noticed that two Javascript files are suddenly marked with yellow backgrounds and an X in the top left corner. When refactoring, IntelliJ says those files are not part of the project, and the files have no syntax highlighting. I checked, and the files are definitely in Git, they're not being mistreated in the file types category, and there is no other evident exception I can find. Here's what it looks like:
The affected files are abstractUtxoCoin.js and baseCoin.js. Quite curiously, when marking any other file as plain text, the context menu shows the option to mark it as Javascript afterwards. With these files, however, there is only the option to mark them as plain text, which remains even after clicking it, which I did as part of some experimentation. Additionally, here's the dialog that appears when trying to rename either file:
What's going on, and how do I fix it? Thanks!
Please sign in to leave a comment.
This icon indicates non-project files - those that are excluded from indexing. Please check Excluded files list in the Project structure - do you have these files listed there? Also, does the issue persist after caches invalidation?
The file is definitely not being excluded using the project structure, and the issue does persist after cache invalidation and restart.
were these files created by hand, or generated?
I created them by hand many commits ago. This change in behavior was sudden.
does the issue persist if you copy these files in a new project?
No, it does not.
can you share a project that can be used to recreate the issue?
I'm afraid I cannot. However, I removed ./.idea/workspace.xml, reopened the project, and that appears to have fixed it.
I ran into a very similar problem and can provide a bit more context. I'm working on a shared React JS UI component library that generates a distribution bundle into a sub-directory named "dist". IntelliJ picked up the types declared in that bundle, so I added the "dist" folder to the exclusion list. That seems to have also automatically picked up the underlying original source files in the "src" folder.
My .idea/workspace.xml file contained the following configuration element:
Removing that block and restarting IntelliJ fixes the problem.
I'm not sure why the component name mentions TypeScript. At some point I toyed with converting all my source files to TypeScript but gave up and reverted the changes. It might have been caused by that.
the built-in TypeScript compiler, when enabled, auto-excludes the generated .js files from indexing by adding them to exactExcludedFiles list in workspace.xml. If your javascript files have the same names as generated files, this would mark them excluded. Removing the from the list manually should help
I disabled the TypeScript, invalidated the cache and restarted. Still have the same issue. All the JS files are ignored in the project. This is annoying because it breaks any refactoring I do between PHP and JS files. You should fix this. I don't have any JS file in the exactExcludedFiles tag. And I already made sure all the folders are added to the project.
try checking Exclude files: filter in Settings | Directories
We could reproduce this behaviour on Webstorm 193.6494.34
We renamed a .js file to .ts and then used Webstorm's Rollback action to change the file back to .js. As a side effect this file is then added to the `exactExcludedFiles` option.
https://youtrack.jetbrains.com/issue/WEB-30895 is fixed in the next major update (2020.2)
AAAAAAAAAA
You guy MUST be joking!!
I . can . not . beliiiiiiiiiieve . this.
This /*&àéè£!£/ç%& has just caused me a _major_ headache _in addition_ to causing me a bug in production that ... tzzz... --- ok, it _almost_ caused a prod bug. But would rather not need to depend on the kind of dumb and boring manual testing that has _luckily been _ done by a colleague.
Unbelievable. This is simply far beyond.
Please!!! Pull youselves together, dear folks at JetBrans. And at _fix_ this asap. I had migrated a file from .ts to .js and since then it has - obviously - never been included in the index any more. And a stale / inacurate index is of course exactly the kind of poison that will very very quickly make us all very very seriously ill.
"adding them to exactExcludedFiles list in workspace.xml." --- WHO in their right mind would code something like that without _first_ coding and calling the function that _removes_ "them" from that dreaded list again!!??
Anyhow, I see in the comment above that it has been fixed. :-) Will check how and hopefully not need to come back here.
Rant over.
Peace.
:-( I don't really see anything (no code / branches / IntelliJ fix versions ???) in on that issue tracker link...
it's fixed in 2020.2, see Fix versions field
I am using IntelliJ which exhibits the same bug. But IntelliJ is not mentioned in this ticket.
WebStorm is a host project for JavaScript development; all fixes made there are propagated to other IDEs