How to recover non-project file protection in PhpStorm?

Viewed 62

This dialog appears when I try to edit non-project files. I chose the 1st option, but I want to recover this protection. Restart didn't help.

enter image description here

1 Answers

Starting at some version, the IDE will no longer show this dialog for the recently edited files. You need to remove such a file from the recently edited files list to get back this popup for that file.

Sadly you cannot do this from the UI so you will have to edit the config files directly. This will be a bit tricky as it involves looking in 2 different places (config files) and editing one of them.

NOTE: this applies to the 1st option ("I want to edit this file anyway"). It may work completely differently for the 2nd option (directory exclusion most likely will be stored in a different place).


Do this while the project is CLOSED in the IDE (or even better, the whole IDE is closed).

  1. Open this project settings folder, locate workspace.xml file and open it in your plain text editor, i.e. PROJECT_ROOT/.idea/workspace.xml.

  2. Locate the component node with ProjectId name. You need the value of the id attribute.

    <component name="ProjectId" id="1OVsD6SX2AzSazagHBXOTEBLIaW" />
    

    We are now done with this file.

  3. Go to your IDE-wide config folder. On Linux that would normally be ~/.config/JetBrains/PhpStorm2022.1 for the current PhpStorm 2022.1 version. For other OS: https://www.jetbrains.com/help/phpstorm/directories-used-by-the-ide-to-store-settings-caches-plugins-and-logs.html#config-directory

    NOTE: if you have installed your IDE using JetBrains Toolbox App, the path might be different. You need to see idea.log file (Help | Show Log in XXX) for the used paths (they are printed at the start of each IDE launch session), although it should be possible to open such a folder right from the Toolbox App interface.

  4. Locate the file named with the id value from step 2 in the workspace folder there. E.g. in my example that would be IDE_CONFIG/workspace/1OVsD6SX2AzSazagHBXOTEBLIaW.xml

    This is the file with your local IDE workspace for this project that is not meant to be shared/synced (as it contains user/machine specific paths etc.)

  5. Open that file in your plain text editor and locate the <component name="IdeDocumentHistory"> node.

    You need to remove unwanted entries from the <changedPaths> sub-node. E.g.

    <option value="$PROJECT_DIR$/vendor/doctrine/orm/lib/Doctrine/ORM/EntityManagerInterface" />
    
  6. Save and exit. Launch the IDE and do your test.

Related