简体   繁体   English

如何防止phpstorm在磁盘上的文件更改时重新加载文件而不提示?

[英]How to prevent phpstorm to reload file without prompt when file on disk is changed?

When a file is open by phpstorm, and I make some changes without save.当一个文件被phpstorm打开时,我做了一些更改而不保存。 But at the same time, the file on disk is changed.但与此同时,磁盘上的文件也发生了变化。 Then phpstorm will reload the file from disk, without prompt.然后 phpstorm 将从磁盘重新加载文件,没有提示。 All my changes will lost.我的所有更改都将丢失。

  1. Settings/Preferences | Appearance & Behavior | System Settings

  2. Untick Synchronize files on frame activation option取消勾选Synchronize files on frame activation

Now PhpStorm will ask you what to do: you will have few options to choose from:现在 PhpStorm 会问你该怎么做:你将有几个选项可供选择:

  • Load File System Changes (load external changes from file)加载文件系统更改(从文件加载外部更改)
  • Keep Memory Changes (ignore external changes and continue with text in editor)保留 Memory 更改(忽略外部更改并继续编辑器中的文本)
  • Show Difference (show difference view to see the difference and decide what needs to be changed manually)显示差异(显示差异视图以查看差异并决定需要手动更改的内容)

@LazyOne's answer pertains to an earlier version of PhpStorm. @LazyOne 的答案与 PhpStorm 的早期版本有关。 In PhpStorm 8.0 there are two checkboxes to provide more granular control over your file synchronization settings:在 PhpStorm 8.0 中,有两个复选框可以更精细地控制文件同步设置:

  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).在 PhpStorm 中,通过从菜单中选择Preferences或单击 ⌘ Comma (Mac) 或 Ctrl+Alt+S(Linux 和 Windows)打开 Settings / Preferences 对话框。
  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 deactivationSynchronization下,有两个复选框:第一个标记为Synchronize files on frame activation ,第二个标记为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 .当您从另一个应用程序切换到 PhpStorm 时,选中第一个框将检测并重新加载磁盘中的外部文件。
  • Checking the second box will have all modified files saved every time you switch to another application from PhpStorm .每次从 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.如果您取消选中这两个框,PhpStorm 会提供一个简单的提示“磁盘上的文件已更改”,并带有一个链接以在 PhpStorm 中重新加载它们。

When there is conflict between PhpStorm and the file that changes on the disk, you will be asked to choose what to do:当 PhpStorm 与磁盘上更改的文件发生冲突时,您将被要求选择要做什么:

  • Load Changes : Click this button to load the file version produced outside of PhpStorm, and overwrite your local changes.加载更改:单击此按钮以加载在 PhpStorm 之外生成的文件版本,并覆盖您的本地更改。
  • Keep Memory Changes : Click this button to preserve the version produced in PhpStorm and stored in cache.保留 Memory 更改:单击此按钮以保留在 PhpStorm 中生成并存储在缓存中的版本。
  • 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.显示差异单击此按钮可调用差异查看器,该查看器在左侧显示文件系统中的版本,在右侧显示 PhpStorm 版本。

More details can be found in the PhpStorm documentation pages for System Settings and the File Cache Conflict pages.更多详细信息可以在系统设置文件缓存冲突页面的 PhpStorm 文档页面中找到。

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

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