How to prevent phpstorm to reload file without pro

2019-01-25 06:00发布

When a file is open by phpstorm, and I make some changes without save. But at the same time, the file on disk is changed. Then phpstorm will reload the file from disk, without prompt. All my changes will lost.

2条回答
唯我独甜
2楼-- · 2019-01-25 06:45
  1. Settings/Preferences | Appearance & Behavior | System Settings

  2. Untick Synchronize files on frame activation option

Now PhpStorm will ask you what to do: you will have few options to choose from:

  • Load File System Changes (load external changes from file)
  • Keep Memory Changes (ignore external changes and continue with text in editor)
  • Show Difference (show difference view to see the difference and decide what needs to be changed manually)
查看更多
beautiful°
3楼-- · 2019-01-25 06:46

@LazyOne's answer pertains to an earlier version of PhpStorm. In PhpStorm 8.0 there are two checkboxes to provide more granular control over your file synchronization settings:

  1. In PhpStorm, open the Settings / Preferences Dialog by choosing Preferences from the menu or clicking ⌘ Comma (Mac) or Ctrl+Alt+S (Linux and Windows).
  2. Click Appearance & Behavior, then click System Settings.
  3. Under Synchronization, there are two checkboxes: the first is labelled Synchronize files on frame activation and the second is labelled Save files on frame deactivation

Here is what the checkboxes do:

  • Checking the first box will detect and reload external files from the disk when you switch to PhpStorm from another application.
  • Checking the second box will have all modified files saved every time you switch to another application from PhpStorm.
  • If you uncheck both boxes, PhpStorm provids a simple prompt says "File was changed on disk" with a link to reload them in PhpStorm.

When there is conflict between PhpStorm and the file that changes on the disk, you will be asked to choose what to do:

  • Load Changes: Click this button to load the file version produced outside of PhpStorm, and overwrite your local changes.
  • Keep Memory Changes: Click this button to preserve the version produced in PhpStorm and stored in cache.
  • Show Difference Click this button to invoke the differences viewer that shows the version in the file system to the left, and PhpStorm version to the right.

More details can be found in the PhpStorm documentation pages for System Settings and the File Cache Conflict pages.

查看更多
登录 后发表回答