PHP CS Fixer File Watcher causes File Cache Conflict in PHPStorm

痞子三分冷 提交于 2019-12-08 01:40:58

问题


I use a File Watcher defined as this

Here is my watchers.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<TaskOptions>
  <TaskOptions>
    <option name="arguments" value="fix $FileDir$/$FileName$ --verbose " />
    <option name="checkSyntaxErrors" value="false" />
    <option name="description" />
    <option name="exitCodeBehavior" value="ERROR" />
    <option name="fileExtension" value="php" />
    <option name="immediateSync" value="true" />
    <option name="name" value="PHP CS Fixer" />
    <option name="output" value="" />
    <option name="outputFilters">
      <array />
    </option>
    <option name="outputFromStdout" value="false" />
    <option name="program" value="/usr/local/bin/php-cs-fixer" />
    <option name="scopeName" value="Project Files" />
    <option name="trackOnlyRoot" value="false" />
    <option name="workingDir" value="$ProjectFileDir$" />
    <envs />
  </TaskOptions>
</TaskOptions>

While autosave executes, sometimes I am getting an error message about the conflict between changes in memory and on disk.

How can I solve this issue?


回答1:


It happens because PHP CS Fixer modifies the file, as @LazyOne said, but you have empty value of "Output paths to refresh" so IDE cannot know about these changes.

Set the value of "Output paths to refresh" to $FileName$ - same as in arguments - to make PhpStorm aware about the changes (it depends on the "Working directory" value which has been set in Other Options - if it is set to $FileDir$ then you don't need to mention it in the paths to refresh).



来源:https://stackoverflow.com/questions/44073562/php-cs-fixer-file-watcher-causes-file-cache-conflict-in-phpstorm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!