PY-18181 Folding: Folding doesn't work with 'with' statement
authorLiana Bakradze <liana.bakradze@jetbrains.com>
Mon, 18 Jan 2016 12:57:27 +0000 (15:57 +0300)
committerLiana Bakradze <liana.bakradze@jetbrains.com>
Mon, 18 Jan 2016 13:00:02 +0000 (16:00 +0300)
python/src/com/jetbrains/python/PythonFoldingBuilder.java

index 1cf3c42d8d6910044e36f79b5e4cc9e3882786ae..d78f3fded2d1f2380bfbca6ea4eb3303f608ef2e 100644 (file)
@@ -150,7 +150,7 @@ public class PythonFoldingBuilder extends CustomFoldingBuilder implements DumbAw
   }
 
   private static boolean ifFoldBlocks(ASTNode statementList, IElementType parentType) {
   }
 
   private static boolean ifFoldBlocks(ASTNode statementList, IElementType parentType) {
-    if (!PyElementTypes.PARTS.contains(parentType)) {
+    if (!PyElementTypes.PARTS.contains(parentType) && parentType != PyElementTypes.WITH_STATEMENT) {
       return false;
     }
     PsiElement element = statementList.getPsi();
       return false;
     }
     PsiElement element = statementList.getPsi();