Non project files protection when editing files from the project
This started happening after I updated to PhpStorm 2021.2. I opened up a WordPress project in the project root (where wp-config.php is located) and when I want to edit a file in my theme I get the 'You are trying to edit a non-project file' (file protection window).
I tried invalidating the cache, deleting the .idea folder, but the same thing happens every time I reopen the project.
I'm on Win 10, the about details are:
PhpStorm 2021.2
Build #PS-212.4746.100, built on July 28, 2021
Runtime version: 11.0.11+9-b1504.13 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 2038M
Cores: 16
Registry: debugger.watches.in.variables=false, run.processes.with.pty=TRUE, ide.experimental.ui.toolwindow.stripes=true, ide.balloon.shadow.size=0
Non-Bundled Plugins: Statistic (4.1.7), com.intellij.ideolog (203.0.27.0), zielu.gittoolbox (212.7.5), com.mallowigi (38.0.0), name.kropp.intellij.makefile (212.4746.52), com.intellij.plugins.html.instantEditing (212.4746.57), com.laravel_idea.tailwind (1.3.1), com.dmarcotte.handlebars (212.4746.57), NEON support (0.5.1), com.chrisrm.idea.MaterialThemeUI (6.8.0.1), de.espend.idea.laravel (0.15.4), com.pestphp.pest-intellij (1.0.3), de.espend.idea.php.annotation (8.0.0), fr.adrienbrault.idea.symfony2plugin (0.23.210), ru.adelf.idea.dotenv (2021.3.0.212)
请先登录再写评论。
Hi there,
As a starting point: please show a screenshot of the whole IDE window; should show the Project View panel with that file opened and focused in particular (use Default or Darcula theme please, not custom ones -- colors used can be important here) -- this may give some clues on what situation you have got there.
It seems to be an intermitten issue. Sometimes it happens, sometimes it doesn't. Could the custom theme be the issue? I'm using the material theme.
Here' the screenshot when I'm trying to edit a file in my project
Theme: unlikely (it is just weird colors since I'm not familiar with them and do not know what underwave or that color may be saying when used more familiar theme)..
Anyway: where the project is located? What is the root folder path?
Basically, I do not like this part:
It should not be like that. For example: one of my projects:
Right now it feels like the project is the whole Z:\ drive.... But that still would not describe the popup. So it's better to see the whole pic/more details.
The project root is the mounted WSL folder. I have mapped it to the Z drive so it's `Z:\home\dzoljom\Sites\Personal\project-name`, the WSL path is `/home/dzoljom/Sites/Personal/project-name`. Windows usually refers the Z: 'drive' as \\wsl$.
No.
Look at the highlighted sections on my screenshot and what you have at your -- see the difference?
I do not see the project name there -- I see a full path from the Z:\ drive root.
What is the project root folder (on Windows)?
Ok, that is super odd. On my other project, it says the project name with a little icon of a laptop, and below is the Project folder icon, and then the folder that is pointing to the folder where the project is.
I can see the External Libraries and Scratches and Consoles differently than in the problematic project.
My Settings > Directories is empty O.o
Ok, I closed the project, deleted it from my project list, and created a new one from the \\wsl$\Ubuntu-20.04\home... directory. Now it looks ok, and doesn't report the issue when opening the config file.
Not sure how I managed to do that one tbh 🤷♂️
Sorry. No ideas what you are talking here. Could be some icons specific to Material UI Theme.
You would need to switch to one of the default themes to have a better support on this bit.
Looks like the project config files might be corrupted .. or some plugin.
Please disable ALL custom (not bundled by default) plugins, restart IDE and see if it helped.
If no changes then try this:
I was also having this problem. PHPStorm decided to mark the root of my repo as a non-project folder and as a result I started getting the warning when editing legitimate VC files within in.
Deleting the .idea sub-folder resolved my issue.
@Kevin Ottley
Do you share .idea in your VCS? If you do ... and you were switching branches or alike -- one of the config files (modules.xml AFAIR) may got wrong (no longer actual) path. If you are interested in knowing that for sure: make a backup of .idea before deleting it when/if it will happen again.
Same problem. Exiting PHP Storm and deleting the .idea then opening it backup worked.
I removed `/home/xxx/.cache/JetBrains` directory and created Project from scratch and it helps.
The downside is that all project will be lost, however IDE Settings stays as they were.
I had the same issue and a solution.
On first attempt to create the project, I messed up setting the correct project directory and chose the folder above (X:\) , so there a .idea subfolder has been generated (X:\.idea). When recreating the project with the correct project root (X:\project-root), another .idea folder existed (X:\project-root\.idea). PhpStorm so detects the files in your (correct) project root as files from the project above. Deleting the wrong .idea subfolder and reopening the correct project solved this issue.
Hope this helps.
I have this problem and it is driving me crazy. Many projects are turning yellow in the left project files pane and editing a file causes the error warning that the file does not belong to the project. The same local project doesn't always appear that way, but, I can't control so far what causes it or prevents it. I've tried clearing cache, Repair IDE, etc.. no luck so far. There was one odd coincidence that I now cannot recall about my workspace.xml file. IDK.
Hammer2j2
Based on my experience, this is happening when you checkout a project that has missing config files in .idea folder.
To workaround the problem simply delete the .idea folder while IDE is closed. It would recreate the config files & the issue would go away.