简体   繁体   English

WebStorm 在从 TS 到 JS 时错误地将源文件标记为已排除

[英]WebStorm incorrectly marking source files as excluded when going from TS to JS

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.我有一个混合了 JavaScript+Flow 和 TypeScript 的 React 项目——我正在迭代地将 JS 文件重构为 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 .在我的工作流程中,我有时会在 Git 个分支之间来回走动,在这些分支中,我可能已将特定的 JS 文件(如App.js )重命名为App.tsx ,而在另一个不相关的分支中,它仍称为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.我注意到,当我将App.js转换为App.tsx时,一切都很好,但是当我切换回仍将其设置为App.js的分支时,WebStorm 出于某种原因将 JS 文件标记为已忽略索引,我不知道如何将它设置回作为索引的一部分,而我在其他没有重命名文件的 git 分支机构工作——它现在永远被排除在 TSX 分支机构之外。 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.下面是我正在谈论的一些截图。

WebStorm 图片 1

WebStorm 图片 2

I hope all of that was clear.我希望所有这些都清楚。 Can anybody help with this?有人可以帮忙吗?

Known issue, related to auto-excluding .js files generated by the built-in compiler from indexing, WEB-30895 .已知问题,与从索引中自动排除内置编译器生成的.js文件有关, WEB-30895 As a workaround, try removing these .js files from "exactExcludedFiles" list in .idea/workspace.xml , <component name="TypeScriptGeneratedFilesManager"> section, like:作为解决方法,尝试从.idea/workspace.xml"exactExcludedFiles"列表中删除这些.js文件, <component name="TypeScriptGeneratedFilesManager">部分,例如:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM