// Path: src/main/java/org/antlr/jetbrains/st4plugin/psi/STFile.java
// public class STFile extends PsiFileBase {
// 
//     protected STFile(@NotNull FileViewProvider viewProvider) {
//         super(viewProvider, STLanguage.INSTANCE);
//     }
// 
//     @NotNull
//     @Override
//     public FileType getFileType() {
//         return STFileType.INSTANCE;
//     }
// 
//     @Override
//     public String toString() {
//         return "String Template file";
//     }
// 
//     @Nullable
//     @Override
//     public Icon getIcon(int flags) {
//         return Icons.STG_FILE;
//     }
// }
// 
// Path: src/main/java/org/antlr/jetbrains/st4plugin/psi/STTokenTypes.java
// public static RuleIElementType getRuleElementType(@MagicConstant(valuesFromClass = STParser.class) int ruleIndex) {
//     return RULE_ELEMENT_TYPES.get(ruleIndex);
// }
// 
// Path: src/main/java/org/antlr/jetbrains/st4plugin/psi/STTokenTypes.java
// public static TokenIElementType getTokenElementType(@MagicConstant(valuesFromClass = STLexer.class) int ruleIndex) {
//     return TOKEN_ELEMENT_TYPES.get(ruleIndex);
// }


import com.intellij.lang.ASTNode;
import com.intellij.lang.folding.CustomFoldingBuilder;
import com.intellij.lang.folding.FoldingDescriptor;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import org.antlr.jetbrains.st4plugin.parsing.STLexer;
import org.antlr.jetbrains.st4plugin.parsing.STParser;
import org.antlr.jetbrains.st4plugin.psi.STFile;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import static org.antlr.jetbrains.st4plugin.psi.STTokenTypes.getRuleElementType;
import static org.antlr.jetbrains.st4plugin.psi.STTokenTypes.getTokenElementType;
package org.antlr.jetbrains.st4plugin.folding;




public class STFoldingBuilder extends CustomFoldingBuilder {
    @Override
    protected void buildLanguageFoldRegions(@NotNull List<FoldingDescriptor> descriptors,
                                            @NotNull PsiElement root,
                                            @NotNull Document document,
                                            boolean quick) {
// Path: src/main/java/org/antlr/jetbrains/st4plugin/psi/STFile.java
// public class STFile extends PsiFileBase {
// 
//     protected STFile(@NotNull FileViewProvider viewProvider) {
//         super(viewProvider, STLanguage.INSTANCE);
//     }
// 
//     @NotNull
//     @Override
//     public FileType getFileType() {
//         return STFileType.INSTANCE;
//     }
// 
//     @Override
//     public String toString() {
//         return "String Template file";
//     }
// 
//     @Nullable
//     @Override
//     public Icon getIcon(int flags) {
//         return Icons.STG_FILE;
//     }
// }
// 
// Path: src/main/java/org/antlr/jetbrains/st4plugin/psi/STTokenTypes.java
// public static RuleIElementType getRuleElementType(@MagicConstant(valuesFromClass = STParser.class) int ruleIndex) {
//     return RULE_ELEMENT_TYPES.get(ruleIndex);
// }
// 
// Path: src/main/java/org/antlr/jetbrains/st4plugin/psi/STTokenTypes.java
// public static TokenIElementType getTokenElementType(@MagicConstant(valuesFromClass = STLexer.class) int ruleIndex) {
//     return TOKEN_ELEMENT_TYPES.get(ruleIndex);
// }


// Path: src/main/java/org/antlr/jetbrains/st4plugin/folding/STFoldingBuilder.java
import com.intellij.lang.ASTNode;
import com.intellij.lang.folding.CustomFoldingBuilder;
import com.intellij.lang.folding.FoldingDescriptor;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import org.antlr.jetbrains.st4plugin.parsing.STLexer;
import org.antlr.jetbrains.st4plugin.parsing.STParser;
import org.antlr.jetbrains.st4plugin.psi.STFile;
import org.jetbrains.annotations.NotNull;
import java.util.List;
import static org.antlr.jetbrains.st4plugin.psi.STTokenTypes.getRuleElementType;
import static org.antlr.jetbrains.st4plugin.psi.STTokenTypes.getTokenElementType;

package org.antlr.jetbrains.st4plugin.folding;




public class STFoldingBuilder extends CustomFoldingBuilder {
    @Override
    protected void buildLanguageFoldRegions(@NotNull List<FoldingDescriptor> descriptors,
                                            @NotNull PsiElement root,
                                            @NotNull Document document,
                                            boolean quick) {
        if (!(root instanceof STFile)) {