Pasting content in *.xlf files leads to PHPStorm freeze of ~20 seconds
PHPStorm 2021.3.3, TYPO3 Coding Tools v0.1.3, TYPO3 Fluid/TypoScript v2.6.0, TYPO3 CMS Support v213.7.3
When pasting content via Strg+V or context menu "Paste" in an editor window of an *.xlf file with plugin "TYPO3 Coding Tools v0.1.3" activated ths leads to a PHPStorm freeze of ~20 seconds. It does not occur when the plugin is deactivated.
Selecting "Help->Collect Logs and Diagnostic Data" after such a freeze and opening the created zip file shows PHPStorm adds a freeze event like "threadDumps-freeze-20220427-143258-PS-213.7172.28-22sec". The created log contains exceptions like this one:
java.lang.Thread.State: RUNNABLE
at com.intellij.psi.impl.source.tree.RecursiveTreeElementWalkingVisitor$ASTTreeGuide.getNextSibling(RecursiveTreeElementWalkingVisitor.java:38)
at com.intellij.psi.impl.source.tree.RecursiveTreeElementWalkingVisitor$ASTTreeGuide.getNextSibling(RecursiveTreeElementWalkingVisitor.java:35)
at com.intellij.util.WalkingState.walkChildren(WalkingState.java:63)
at com.intellij.util.WalkingState.elementStarted(WalkingState.java:49)
at com.intellij.psi.impl.source.tree.RecursiveTreeElementWalkingVisitor.visitNode(RecursiveTreeElementWalkingVisitor.java:86)
at com.intellij.psi.impl.source.tree.RecursiveTreeElementWalkingVisitor.visitComposite(RecursiveTreeElementWalkingVisitor.java:81)
at com.intellij.psi.impl.source.tree.AstBufferUtil$BufferVisitor.visitComposite(AstBufferUtil.java:96)
at com.intellij.psi.impl.source.tree.CompositeElement.acceptTree(CompositeElement.java:117)
at com.intellij.psi.impl.source.tree.AstBufferUtil.toBuffer(AstBufferUtil.java:22)
at com.intellij.psi.impl.source.tree.AstBufferUtil.toBuffer(AstBufferUtil.java:17)
at com.intellij.psi.impl.source.tree.CompositeElement.textToCharArray(CompositeElement.java:230)
at com.intellij.psi.impl.source.tree.CompositeElement.getText(CompositeElement.java:212)
at de.fgalinski.typo3.xliff.editor.formatter.XlfIndentProcessor.getAbsoluteNoneIndentForTag(XlfIndentProcessor.java:81)
at de.fgalinski.typo3.xliff.editor.formatter.XlfIndentProcessor.getIndent(XlfIndentProcessor.java:55)
at de.fgalinski.typo3.xliff.editor.formatter.XlfBlock.<init>(XlfBlock.java:39)
at de.fgalinski.typo3.xliff.editor.formatter.XlfBlock.buildChildren(XlfBlock.java:67)
at com.intellij.psi.formatter.common.AbstractBlock.getSubBlocks(AbstractBlock.java:48)
at com.intellij.formatting.InitialInfoBuilder.buildFrom(InitialInfoBuilder.java:137)
at com.intellij.formatting.InitialInfoBuilder.doIteration(InitialInfoBuilder.java:212)
at com.intellij.formatting.InitialInfoBuilder.iteration(InitialInfoBuilder.java:109)
at com.intellij.formatting.engine.WrapBlocksState.doIteration(WrapBlocksState.java:47)
at com.intellij.formatting.engine.State.iteration(State.java:25)
at com.intellij.formatting.engine.StateProcessor.iteration(StateProcessor.java:26)
at com.intellij.formatting.FormatProcessor.iteration(FormatProcessor.java:108)
at com.intellij.formatting.FormatterImpl.buildProcessorAndWrapBlocks(FormatterImpl.java:401)
at com.intellij.formatting.FormatterImpl.buildProcessorAndWrapBlocks(FormatterImpl.java:386)
at com.intellij.formatting.FormatterImpl.adjustLineIndentsForRange(FormatterImpl.java:285)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl$3.doPerform(CodeStyleManagerImpl.java:295)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerRunnable.perform(CodeStyleManagerRunnable.java:93)
at com.intellij.psi.impl.source.codeStyle.CodeStyleManagerImpl.adjustLineIndent(CodeStyleManagerImpl.java:298)
at com.intellij.codeInsight.editorActions.DefaultTypingActionsExtension.adjustLineIndent(DefaultTypingActionsExtension.java:90)
at com.intellij.codeInsight.editorActions.DefaultTypingActionsExtension.indentEachLine(DefaultTypingActionsExtension.java:169)
at com.intellij.codeInsight.editorActions.DefaultTypingActionsExtension.format(DefaultTypingActionsExtension.java:69)
at com.intellij.codeInsight.editorActions.PasteHandler.lambda$doPasteAction$5(PasteHandler.java:242)
at com.intellij.codeInsight.editorActions.PasteHandler$$Lambda$8163/0x00000001001c4840.run(Unknown Source)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:947)
at com.intellij.codeInsight.editorActions.PasteHandler.doPasteAction(PasteHandler.java:240)
at com.intellij.codeInsight.editorActions.PasteHandler.doPaste(PasteHandler.java:122)
at com.intellij.codeInsight.editorActions.PasteHandler.lambda$execute$2(PasteHandler.java:103)
at com.intellij.codeInsight.editorActions.PasteHandler$$Lambda$8155/0x00000001001bb040.run(Unknown Source)
at com.intellij.openapi.project.DumbService.runWithAlternativeResolveEnabled(DumbService.java:383)
at com.intellij.codeInsight.editorActions.PasteHandler.execute(PasteHandler.java:94)
at com.intellij.codeInsight.editorActions.PasteHandler.doExecute(PasteHandler.java:50)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.lambda$execute$4(EditorActionHandler.java:199)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler$$Lambda$7461/0x00000001029e8840.perform(Unknown Source)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:89)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:198)
at com.intellij.codeInsight.editorActions.LanguageConsolePasteHandler.doExecute(LanguageConsolePasteHandler.kt:24)
at com.intellij.openapi.editor.actionSystem.DynamicEditorActionHandler.doExecute(DynamicEditorActionHandler.java:63)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.lambda$execute$4(EditorActionHandler.java:199)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler$$Lambda$7461/0x00000001029e8840.perform(Unknown Source)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.doIfEnabled(EditorActionHandler.java:89)
at com.intellij.openapi.editor.actionSystem.EditorActionHandler.execute(EditorActionHandler.java:198)
at com.intellij.openapi.editor.actionSystem.EditorAction.lambda$actionPerformed$0(EditorAction.java:89)
at com.intellij.openapi.editor.actionSystem.EditorAction$$Lambda$7460/0x00000001029e9c40.run(Unknown Source)
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.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:98)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:73)
at com.intellij.openapi.keymap.impl.ActionProcessor.performAction(ActionProcessor.java:65)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:573)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$doPerformActionInner$10(IdeKeyEventDispatcher.java:706)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$$Lambda$7065/0x000000010286a440.run(Unknown Source)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:260)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.doPerformActionInner(IdeKeyEventDispatcher.java:702)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:645)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:584)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:467)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:456)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:224)
at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.java:804)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:754)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:447)
at com.intellij.ide.IdeEventQueue$$Lambda$333/0x00000001004efc40.compute(Unknown Source)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:818)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:446)
at com.intellij.ide.IdeEventQueue$$Lambda$332/0x00000001004c1440.run(Unknown Source)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:805)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:498)
at java.desktop@11.0.14.1/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop@11.0.14.1/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop@11.0.14.1/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop@11.0.14.1/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop@11.0.14.1/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop@11.0.14.1/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
where apparently de.fgalinski.typo3.xliff.editor.formatter.XlfIndentProcessor.getAbsoluteNoneIndentForTag(XlfIndentProcessor.java:81)
wants to do stuff and during this somehow com.intellij.psi.impl.source.tree.RecursiveTreeElementWalkingVisitor$ASTTreeGuide.getNextSibling(RecursiveTreeElementWalkingVisitor.java
is called recursively and bails out after some time.
Could you please have a look what is wrong here? I had to disable the plugin in order to be able to work.