enriquepiatti / Magicento

PHPStorm plugin for Magento developers
115 stars 35 forks source link

Exception creating module for magento 1 #322

Closed cdittmar closed 2 years ago

cdittmar commented 2 years ago

When I create a new module for magento 1 I get an exception. The module configuration file in app/etc is created but empty. PhpStorm Version 2022.2 (Build #PS-222.3345.135), Magicento Version 3.3.4

java.lang.AssertionError: Wrong line separators: '...on=\"1.0\"?>\r\n<config>...' at offset 21 at com.intellij.openapi.util.text.StringUtil.assertValidSeparators(StringUtil.java:2418) at com.intellij.openapi.editor.impl.DocumentImpl.assertValidSeparators(DocumentImpl.java:715) at com.intellij.openapi.editor.impl.DocumentImpl.replaceString(DocumentImpl.java:609) at com.intellij.openapi.editor.impl.DocumentImpl.lambda$setText$2(DocumentImpl.java:1086) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:164) at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:150) at com.intellij.openapi.editor.impl.DocumentImpl.setText(DocumentImpl.java:1091) at com.intellij.psi.impl.file.PsiDirectoryImpl.add(PsiDirectoryImpl.java:414) at com.magicento.extensions.MagicentoTemplateFactory$1.run(MagicentoTemplateFactory.java:117) at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1023) at com.magicento.extensions.MagicentoTemplateFactory.createFromTemplate(MagicentoTemplateFactory.java:113) at com.magicento.extensions.MagicentoTemplateFactory.createFromTemplate(MagicentoTemplateFactory.java:143) at com.magicento.actions.CreateModuleAction.createModuleXmlFile(CreateModuleAction.java:217) at com.magicento.actions.CreateModuleAction.executeAction(CreateModuleAction.java:56) at com.magicento.actions.MagicentoActionAbstract.actionPerformed(MagicentoActionAbstract.java:407) at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.java:315) at com.intellij.openapi.actionSystem.ex.ActionUtil.lambda$performActionDumbAwareWithCallbacks$4(ActionUtil.java:294) at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:337) at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAwareWithCallbacks(ActionUtil.java:294) at com.intellij.openapi.actionSystem.ex.ActionUtil.invokeAction(ActionUtil.java:516) at com.intellij.ui.popup.ActionPopupStep.performAction(ActionPopupStep.java:232) at com.intellij.ui.popup.ActionPopupStep.lambda$onChosen$1(ActionPopupStep.java:220) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105) at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94) at com.intellij.ui.popup.AbstractPopup.lambda$dispose$18(AbstractPopup.java:1543) at com.intellij.util.ui.EdtInvocationManager.invokeLaterIfNeeded(EdtInvocationManager.java:113) at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:179) at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:132) at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:163) at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1540) at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:162) at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:326) at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.dispose(PopupFactoryImpl.java:266) at com.intellij.openapi.util.ObjectTree.runWithTrace(ObjectTree.java:126) at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:158) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:217) at com.intellij.openapi.util.Disposer.dispose(Disposer.java:205) at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:266) at com.intellij.ui.popup.list.ListPopupImpl.handleNextStep(ListPopupImpl.java:434) at com.intellij.ui.popup.list.ListPopupImpl._handleSelect(ListPopupImpl.java:406) at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:356) at com.intellij.ui.popup.list.ListPopupImpl$1.actionPerformed(ListPopupImpl.java:269) at com.intellij.ui.popup.WizardPopup.proceedKeyEvent(WizardPopup.java:378) at com.intellij.ui.popup.WizardPopup.dispatch(WizardPopup.java:354) at com.intellij.ui.popup.PopupDispatcher.dispatchKeyEvent(PopupDispatcher.java:112) at com.intellij.ui.popup.PopupDispatcher.dispatch(PopupDispatcher.java:148) at com.intellij.ide.IdePopupManager.dispatch(IdePopupManager.java:109) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:710) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:439) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:438) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113) 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:881) 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)

enriquepiatti commented 2 years ago

Hi, please check your line separators config, maybe there is some problem there: https://www.jetbrains.com/help/idea/configuring-line-endings-and-line-separators.html Also if you cannot change that, you can edit the templates used by Magicento

viktorsteinwand commented 2 years ago

Hi, I've the same issue while adding new module. Line separators are set to System-Dependent. Working on M1 MacOs 12.5 with PhpStorm 2022.2 and Magicento 3.3.4. Changing the line separator did not work. I also could not find any template being used to create new modules....

boorlyk commented 2 years ago

@viktorsteinwand try to check Preferences -> Editor -> File and Code Templates -> Other I have found it there

viktorsteinwand commented 2 years ago

@boorlyk @enriquepiatti PhpStorm displays following error when I try to select some template: "Cannot Save Current Template, Invalid template file name or extension"

Bildschirmfoto 2022-08-19 um 15 26 09
boorlyk commented 2 years ago

@viktorsteinwand i saw the same, restart phpstorm, that helped me.

viktorsteinwand commented 2 years ago

@boorlyk restarting php storm do not work for me...

boorlyk commented 2 years ago

@viktorsteinwand after restart try to update the following template first Preferences -> Editor -> File and Code Templates -> Includes -> XML File Header then Apply and restart phpstorm again.

In my case issue was that XML File Header contained some invalid special character what crashed the PHPStorm.

boorlyk commented 2 years ago

@viktorsteinwand

image

Templates which using by magicento uses this header in my case

viktorsteinwand commented 2 years ago

@enriquepiatti @boorlyk PhpStorm Update to 2022.2.1 (Build #PS-222.3739.61, built on August 18, 2022) did solve the issue

enriquepiatti commented 2 years ago

Thanks @boorlyk ! it seems a problem with PHP File Header, a quick bugfix is just to edit that header, you can just add a comment, or a whitespace, Save it and then should work (I think you can even then edit Php File Header again to leave it empty and it should work too). I will try to add a bugfix in a new release.

enriquepiatti commented 2 years ago

Actually, to bugfix this you can edit any template from "Includes" (probably from any other category too), the important thing is just to edit some template, save it, and PhpStorm will "fix" the invalid templates from Magicento while saving. I'm trying to figure out why the templates are suddenly invalid in 2022.2+ and why even without editing them, PhpStorm seems to fix them while saving any other valid template.

Note this is a bug from PhpStorm, they will probably fix it in a next release, meanwhile you can use the the workaround: https://youtrack.jetbrains.com/issue/IDEA-299563/File-and-code-templates-suddenly-fail-if-the-ft-file-has-CRLF-line-endings

cdittmar commented 1 year ago

Hi,

thx for the quick response. The line separators config is set to "Unix and macOs (\n)" as it always was.

I cannot access the templates used by magicento, the input field for the template code is green and if I leave it I get an error message (see attachments).

I tried it on another system which runs an older version of your plugin (3.1.7). There the templates are shown correctly and the module generations works fine.

I hope this can be fixed, I really love this plugin!

Best, Christian

Am 08.08.2022 um 16:40 schrieb Enrique Piatti:

Hi, please check your line separators config, maybe there is some problem there: https://www.jetbrains.com/help/idea/configuring-line-endings-and-line-separators.html Also if you cannot change that, you can edit the templates used by Magicento

— Reply to this email directly, view it on GitHub https://github.com/enriquepiatti/Magicento/issues/322#issuecomment-1208219072, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIYKDXTYDISIY6WREUIGU3VYEL47ANCNFSM554QSWBA. You are receiving this because you authored the thread.Message ID: @.***>

enriquepiatti commented 1 year ago

@cdittmar Version 3.3.5 should fix this issue