Skip to content

Commit

Permalink
feat: add simple fix fo folding
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Sep 28, 2022
1 parent 1b66ce3 commit bc9731f
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package com.feakin.intellij.edit
import com.feakin.intellij.FeakinFile
import com.feakin.intellij.lexer.FeakinElementTypes.LBRACE
import com.feakin.intellij.lexer.FeakinElementTypes.RBRACE
import com.feakin.intellij.psi.FeakinContextBody
import com.feakin.intellij.psi.FeakinContextMapBody
import com.feakin.intellij.psi.FeakinVisitor
import com.feakin.intellij.psi.*
import com.intellij.lang.ASTNode
import com.intellij.lang.folding.CustomFoldingBuilder
import com.intellij.lang.folding.FoldingDescriptor
Expand Down Expand Up @@ -51,9 +49,10 @@ class FeakinFoldingBuilder : CustomFoldingBuilder(), DumbAware {
}

private class FoldingVisitor(private val descriptors: MutableList<FoldingDescriptor>) : FeakinVisitor() {
override fun visitContextBody(o: FeakinContextBody) = fold(o)
override fun visitContextDeclaration(o: FeakinContextDeclaration) = fold(o)

override fun visitContextMapDeclaration(o: FeakinContextMapDeclaration) = fold(o)

override fun visitContextMapBody(o: FeakinContextMapBody) = fold(o)
private fun fold(element: PsiElement) {
descriptors += FoldingDescriptor(element.node, element.textRange)
}
Expand Down

0 comments on commit bc9731f

Please sign in to comment.