问题
I have a React project that is a mix of JavaScript+Flow and TypeScript -- and I am in the process of iteratively refactoring the JS files to TS/TSX.
In my workflow I'm sometimes going to-and-fro between Git branches, and in these branches, I may have renamed a specific JS file like App.js
to App.tsx
and in another unrelated branch, it is still called App.js
.
I've noticed that when I convert App.js
to App.tsx
, everything is fine, but when I toggle back to the branch that still has it set as App.js
, WebStorm for whatever reason has the JS file marked as ignored from indexing and I have no idea how to set it back to be included as part of indexing while I am working in other git branches that do not have the file renamed -- it is now forever excluded outside of the TSX branch. I've tried invalidating the caches to force reindexing but that did not resolve the issue. Below are some screenshots of what I'm talking about.
I hope all of that was clear. Can anybody help with this?
回答1:
Known issue, related to auto-excluding .js
files generated by the built-in compiler from indexing, WEB-30895.
As a workaround, try removing these .js
files from "exactExcludedFiles"
list in .idea/workspace.xml
, <component name="TypeScriptGeneratedFilesManager">
section, like:
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="1" />
<option name="exactExcludedFiles">
<list>
<option value="$PROJECT_DIR$/path/to/App.js" />
...
</list>
</option>
</component>
来源:https://stackoverflow.com/questions/61853911/webstorm-incorrectly-marking-source-files-as-excluded-when-going-from-ts-to-js