Search in sources :

Example 1 with PropertyStubElementType

use of com.intellij.lang.properties.parsing.PropertyStubElementType in project intellij-community by JetBrains.

the class PropertiesRootBlock method buildChildren.

@Override
protected List<Block> buildChildren() {
    final List<Block> result = new ArrayList<>();
    ASTNode child = myNode.getFirstChildNode();
    while (child != null) {
        if (!(child instanceof PsiWhiteSpace)) {
            if (child.getElementType() instanceof PropertyListStubElementType) {
                ASTNode propertyNode = child.getFirstChildNode();
                while (propertyNode != null) {
                    if (propertyNode.getElementType() instanceof PropertyStubElementType) {
                        collectPropertyBlock(propertyNode, result);
                    } else if (PropertiesTokenTypes.END_OF_LINE_COMMENT.equals(propertyNode.getElementType()) || PropertiesTokenTypes.BAD_CHARACTER.equals(propertyNode.getElementType())) {
                        result.add(new PropertyBlock(propertyNode, null));
                    }
                    propertyNode = propertyNode.getTreeNext();
                }
            } else if (PropertiesTokenTypes.BAD_CHARACTER.equals(child.getElementType())) {
                result.add(new PropertyBlock(child, null));
            }
        }
        if (PropertiesTokenTypes.END_OF_LINE_COMMENT.equals(child.getElementType())) {
            result.add(new PropertyBlock(child, null));
        }
        child = child.getTreeNext();
    }
    return result;
}
Also used : PropertyListStubElementType(com.intellij.lang.properties.parsing.PropertyListStubElementType) PropertyStubElementType(com.intellij.lang.properties.parsing.PropertyStubElementType) ArrayList(java.util.ArrayList) ASTNode(com.intellij.lang.ASTNode) AbstractBlock(com.intellij.psi.formatter.common.AbstractBlock) PsiWhiteSpace(com.intellij.psi.PsiWhiteSpace)

Aggregations

ASTNode (com.intellij.lang.ASTNode)1 PropertyListStubElementType (com.intellij.lang.properties.parsing.PropertyListStubElementType)1 PropertyStubElementType (com.intellij.lang.properties.parsing.PropertyStubElementType)1 PsiWhiteSpace (com.intellij.psi.PsiWhiteSpace)1 AbstractBlock (com.intellij.psi.formatter.common.AbstractBlock)1 ArrayList (java.util.ArrayList)1