pest-intellij icon indicating copy to clipboard operation
pest-intellij copied to clipboard

com.intellij.util.IncorrectOperationException: Cannot modify a read-only directory

Open mdeboer opened this issue 2 years ago • 6 comments

Q A
Bug report? yes
Plugin version 1.6.2
Pest version 1.21.3
IntelliJ version PS-221.5787.33
OS Linux

Description

Working with docker, the vendor directory is mounted from outside the container therefore the directory can probably not be changed (renamed or whatever is attempted).

It is unclear to me why it does this, besides the constant error it is working just fine.

Stacktrace

com.intellij.util.IncorrectOperationException: Cannot modify a read-only directory '<redacted path to project>/vendor'.

com.intellij.util.IncorrectOperationException: Cannot modify a read-only directory '<redacted path to project>/vendor'.
	at com.intellij.psi.impl.CheckUtil.checkWritable(CheckUtil.java:22)
	at com.intellij.psi.impl.file.PsiDirectoryImpl.checkAdd(PsiDirectoryImpl.java:455)
	at com.intellij.psi.impl.file.PsiDirectoryImpl.add(PsiDirectoryImpl.java:400)
	at com.pestphp.pest.customExpectations.ExpectationFileService$generateFile$2$1$1.run(ExpectationFileService.kt:80)
	at com.intellij.openapi.project.DumbServiceHeavyActivities.suspendIndexingAndRun(DumbServiceHeavyActivities.java:21)
	at com.intellij.openapi.project.DumbServiceImpl.suspendIndexingAndRun(DumbServiceImpl.java:190)
	at com.pestphp.pest.customExpectations.ExpectationFileService$generateFile$lambda-5$$inlined$runWriteAction$1.compute(actions.kt:60)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$runWriteAction$13(ApplicationImpl.java:1024)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteActionWithClass(ApplicationImpl.java:1003)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1024)
	at com.pestphp.pest.customExpectations.ExpectationFileService.generateFile$lambda-5(ExpectationFileService.kt:105)
	at com.intellij.openapi.project.DumbServiceImpl.lambda$smartInvokeLater$9(DumbServiceImpl.java:533)
	at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:215)
	at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22)
	at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:197)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
	at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:511)
	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:69)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:112)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:42)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:898)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:803)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:604)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:436)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:484)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

mdeboer avatar Jun 04 '22 16:06 mdeboer

Hi, thanks for reporting the issue.

The way the plugin handles custom exceptions is by generating a stub Expectation class inside the vendor folder. So in your case custom expectations will not be working. I currently have not added support for disabling this feature. A few days ago the phpstorm team lead told us of a possible way of not having to generate the file, however it will take a long time to implement and not high on my priority list at all 😄

I might add in a small config soon to disable this feature so you don't get spammed with error messages.

olivernybroe avatar Jun 07 '22 07:06 olivernybroe

@mdeboer Alright, so I am creating a new EAP which has a solution for you.

If you open up the registry, use the all search and search for registry image Then search for pestphp and you will see an option for disabling the custom-expectations image

Disable that and the error should be gone. This is of course just a temporary solution, until we get it solved so it doesn't need access to save a file.

PEST PHP-1.7.0-EAP.3.zip Install it manually using Preferences > Plugins > ⚙️ > Install plugin from disk...

olivernybroe avatar Jun 07 '22 09:06 olivernybroe

Let me give that a try, thanks so much, I will get back to you!

mdeboer avatar Jun 13 '22 12:06 mdeboer

So I have been talking with PhpStorm and unfortunately we cannot do anything here until they make some changes in their code. If you wanna speed it along, then upvoting the issue on YT would be helpful 👍 https://youtrack.jetbrains.com/issue/WI-58509

olivernybroe avatar Jul 11 '22 07:07 olivernybroe

Will do, I must say I haven't had the issue anymore. But I have also been testing the EAP and now Beta version with the new UI. But yes I'll vote!

mdeboer avatar Jul 18 '22 13:07 mdeboer

@mdeboer awesome! Yes, the temporary solution I proposed should fix the exception you kept getting, however it does also mean that you are not able to get autocompletion for custom expectations.

olivernybroe avatar Aug 02 '22 06:08 olivernybroe