Open SingingBush opened 4 years ago
This is a problem with both the formatting code in io.github.intellij.dlanguage.features.formatter.DFormattingModelBuilder and the recursion taking place in DUtil::getPrevSiblingOfType
For now I've made a slight tweak but further investigation is needed.
The formatting code is another area that needs improving and testing. It's probably worth making proper use of
override fun getRangeAffectingIndent(file: PsiFile, offset: Int, elementAtOffset: ASTNode): TextRange? {
return null
}
reported from AppCode 2021.2 (plugin 1.26.1):
java.lang.StackOverflowError: null
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:89)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
this is still an issue in 1.33.1:
java.lang.StackOverflowError: null
at java.util.HashMap.hash(HashMap.java:338)
at java.util.HashMap.getNode(HashMap.java:568)
at java.util.HashMap.containsKey(HashMap.java:594)
at java.util.HashSet.contains(HashSet.java:205)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:92)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
at io.github.intellij.dlanguage.utils.DUtil.getPrevSiblingOfType(DUtil.java:95)
there needs to be a limit on how many times this method is called using recursion: https://github.com/intellij-dlanguage/intellij-dlanguage/blob/d2cbe3acbc3cdaecceb6ae9404368e63c6ee3047/src/main/java/io/github/intellij/dlanguage/utils/DUtil.java#L72-L81
Looks like a rewrite is needed to get rid of the recursion:
while(child != null) {
if (child.getElementType() == type)
return child.getTreePrev();
child = child.getTreePrev();
}
return null;
reported from IDEA 2020.1.2 with plugin version 1.24.1
last action was EditorBackSpace