Search in sources :

Example 41 with LeafPsiElement

use of com.intellij.psi.impl.source.tree.LeafPsiElement in project phpinspectionsea by kalessil.

the class MisorderedModifiersInspector method buildVisitor.

@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder problemsHolder, final boolean isOnTheFly) {
    return new BasePhpElementVisitor() {

        @Override
        public void visitPhpMethod(@NotNull Method method) {
            if (method.isStatic() || method.isAbstract() || method.isFinal()) {
                final PhpModifierList modifiersNode = PsiTreeUtil.findChildOfType(method, PhpModifierList.class);
                final List<LeafPsiElement> modifiers = PsiTreeUtil.findChildrenOfType(modifiersNode, LeafPsiElement.class).stream().filter(element -> !(element instanceof PsiWhiteSpace)).collect(Collectors.toList());
                if (modifiersNode != null && modifiers.size() >= 2) {
                    final String original = this.getOriginalOrder(modifiers);
                    final String expected = this.getExpectedOrder(original, standardOrder);
                    if (!original.equals(expected)) {
                        problemsHolder.registerProblem(modifiersNode, MessagesPresentationUtil.prefixWithEa(message), new TheLocalFix(expected));
                    }
                }
            }
        }

        @NotNull
        private String getOriginalOrder(@NotNull Collection<LeafPsiElement> original) {
            return original.stream().map(LeafElement::getText).collect(Collectors.joining(" ")).toLowerCase();
        }

        @NotNull
        private String getExpectedOrder(@NotNull String original, @NotNull Collection<String> expected) {
            return expected.stream().filter(original::contains).collect(Collectors.joining(" "));
        }
    };
}
Also used : PhpPsiElementFactory(com.jetbrains.php.lang.psi.PhpPsiElementFactory) BasePhpInspection(com.kalessil.phpStorm.phpInspectionsEA.openApi.BasePhpInspection) Collection(java.util.Collection) LeafPsiElement(com.intellij.psi.impl.source.tree.LeafPsiElement) Method(com.jetbrains.php.lang.psi.elements.Method) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) PsiTreeUtil(com.intellij.psi.util.PsiTreeUtil) BasePhpElementVisitor(com.kalessil.phpStorm.phpInspectionsEA.openApi.BasePhpElementVisitor) List(java.util.List) ProblemDescriptor(com.intellij.codeInspection.ProblemDescriptor) LeafElement(com.intellij.psi.impl.source.tree.LeafElement) MessagesPresentationUtil(com.kalessil.phpStorm.phpInspectionsEA.utils.MessagesPresentationUtil) PsiElement(com.intellij.psi.PsiElement) PsiWhiteSpace(com.intellij.psi.PsiWhiteSpace) Project(com.intellij.openapi.project.Project) NotNull(org.jetbrains.annotations.NotNull) LocalQuickFix(com.intellij.codeInspection.LocalQuickFix) PsiElementVisitor(com.intellij.psi.PsiElementVisitor) ProblemsHolder(com.intellij.codeInspection.ProblemsHolder) PhpModifierList(com.jetbrains.php.lang.psi.elements.PhpModifierList) BasePhpElementVisitor(com.kalessil.phpStorm.phpInspectionsEA.openApi.BasePhpElementVisitor) LeafPsiElement(com.intellij.psi.impl.source.tree.LeafPsiElement) Collection(java.util.Collection) Method(com.jetbrains.php.lang.psi.elements.Method) NotNull(org.jetbrains.annotations.NotNull) LeafElement(com.intellij.psi.impl.source.tree.LeafElement) PhpModifierList(com.jetbrains.php.lang.psi.elements.PhpModifierList) PsiWhiteSpace(com.intellij.psi.PsiWhiteSpace) NotNull(org.jetbrains.annotations.NotNull)

Example 42 with LeafPsiElement

use of com.intellij.psi.impl.source.tree.LeafPsiElement in project ballerina by ballerina-lang.

the class BallerinaKeywordsCompletionContributor method fillCompletionVariants.

@Override
public void fillCompletionVariants(@NotNull CompletionParameters parameters, @NotNull CompletionResultSet result) {
    PsiElement element = parameters.getPosition();
    PsiElement parent = element.getParent();
    if (element instanceof LeafPsiElement) {
        IElementType elementType = ((LeafPsiElement) element).getElementType();
        if (elementType == BallerinaTypes.FLOATING_POINT) {
            return;
        }
    }
    if (parent instanceof NameReferenceNode) {
        PsiElement prevVisibleLeaf = PsiTreeUtil.prevVisibleLeaf(element);
        if (prevVisibleLeaf != null && "public".equals(prevVisibleLeaf.getText())) {
            result.addAllElements(getFileLevelKeywordsAsLookups(false, true, true));
        }
        if (prevVisibleLeaf instanceof IdentifierPSINode) {
            result.addElement(getAttachKeyword());
            return;
        }
        ANTLRPsiNode definitionParent = PsiTreeUtil.getParentOfType(parent, CallableUnitBodyNode.class, ServiceBodyNode.class, ConnectorBodyNode.class);
        if (definitionParent != null && prevVisibleLeaf != null && "=".equals(prevVisibleLeaf.getText())) {
            result.addElement(getCreateKeyword());
            result.addElement(getTypeOfKeyword());
            result.addElement(getLengthOfKeyword());
            result.addAllElements(getValueKeywords());
        }
        ExpressionNode expressionNode = PsiTreeUtil.getParentOfType(parent, ExpressionNode.class);
        if (expressionNode != null && expressionNode.getChildren().length == 1) {
            PsiReference referenceAt = parent.findReferenceAt(0);
            if (referenceAt == null || referenceAt instanceof NameReference) {
                result.addAllElements(getValueKeywords());
            }
            PsiElement nextVisibleLeaf = PsiTreeUtil.nextVisibleLeaf(element);
            if ((prevVisibleLeaf != null && "(".equals(prevVisibleLeaf.getText())) || (nextVisibleLeaf != null && ")".equals(nextVisibleLeaf.getText()) && !":".equals(prevVisibleLeaf.getText()))) {
                addOtherTypeAsLookup(result);
                addValueTypesAsLookups(result);
                addReferenceTypesAsLookups(result);
            }
        }
        AnnotationAttachmentNode attachmentNode = PsiTreeUtil.getParentOfType(parent, AnnotationAttachmentNode.class);
        if (attachmentNode != null) {
            result.addAllElements(getValueKeywords());
        }
        TypeNameNode typeNameNode = PsiTreeUtil.getParentOfType(parent, TypeNameNode.class);
        if (typeNameNode != null && prevVisibleLeaf != null && !prevVisibleLeaf.getText().matches("[:.=]")) {
            AnnotationDefinitionNode annotationDefinitionNode = PsiTreeUtil.getParentOfType(typeNameNode, AnnotationDefinitionNode.class);
            if (annotationDefinitionNode == null) {
                addOtherTypeAsLookup(result);
                addXmlnsAsLookup(result);
                addValueTypesAsLookups(result);
                addReferenceTypesAsLookups(result);
            }
        }
    }
    if (parent instanceof StatementNode) {
        PsiElement prevVisibleSibling = PsiTreeUtil.prevVisibleLeaf(element);
        if (prevVisibleSibling != null && "=".equals(prevVisibleSibling.getText())) {
            result.addElement(getCreateKeyword());
            result.addElement(getTypeOfKeyword());
            result.addElement(getLengthOfKeyword());
        }
    }
    if (parent instanceof ConstantDefinitionNode || parent instanceof PsiErrorElement) {
        PsiElement prevVisibleSibling = PsiTreeUtil.prevVisibleLeaf(element);
        if (prevVisibleSibling != null && "const".equals(prevVisibleSibling.getText())) {
            addValueTypesAsLookups(result);
            return;
        }
    }
    if (parent instanceof PsiErrorElement) {
        PsiElement prevVisibleSibling = PsiTreeUtil.prevVisibleLeaf(element);
        PsiElement definitionNode = PsiTreeUtil.getParentOfType(element, FunctionDefinitionNode.class, ServiceDefinitionNode.class, ConnectorDefinitionNode.class, ResourceDefinitionNode.class);
        if (definitionNode != null) {
            if (prevVisibleSibling != null && "=".equals(prevVisibleSibling.getText())) {
                result.addElement(getCreateKeyword());
                result.addAllElements(getValueKeywords());
                result.addElement(getTypeOfKeyword());
                result.addElement(getLengthOfKeyword());
            }
            if (prevVisibleSibling != null && prevVisibleSibling.getText().matches("[;{}]") && !(prevVisibleSibling.getParent() instanceof AnnotationAttachmentNode)) {
                // Todo - change method
                addOtherTypeAsLookup(result);
                addXmlnsAsLookup(result);
                addValueTypesAsLookups(result);
                addReferenceTypesAsLookups(result);
                if (definitionNode instanceof FunctionDefinitionNode) {
                    result.addAllElements(getFunctionSpecificKeywords());
                }
                if (definitionNode instanceof ResourceDefinitionNode) {
                    result.addAllElements(getResourceSpecificKeywords());
                }
                if (definitionNode instanceof ServiceDefinitionNode) {
                    result.addAllElements(getServiceSpecificKeywords());
                }
                if (definitionNode instanceof ConnectorDefinitionNode) {
                    result.addAllElements(getConnectorSpecificKeywords());
                }
                if (!(definitionNode instanceof ServiceDefinitionNode || definitionNode instanceof ConnectorDefinitionNode)) {
                    result.addAllElements(getCommonKeywords());
                }
            }
            if (prevVisibleSibling != null && !prevVisibleSibling.getText().matches("[{}]")) /*|| !(prevVisibleSibling.getParent() instanceof AnnotationAttachmentNode)*/
            {
                result.addAllElements(getValueKeywords());
            }
        }
        ConnectorBodyNode connectorBodyNode = PsiTreeUtil.getParentOfType(element, ConnectorBodyNode.class);
        if (connectorBodyNode != null) {
            result.addAllElements(getConnectorSpecificKeywords());
        }
        ConnectorDefinitionNode connectorDefinitionNode = PsiTreeUtil.getParentOfType(element, ConnectorDefinitionNode.class);
        if (connectorDefinitionNode != null) {
            result.addAllElements(getConnectorSpecificKeywords());
        }
        return;
    }
    if (parent instanceof NameReferenceNode) {
        RecordKeyValueNode recordKeyValueNode = PsiTreeUtil.getParentOfType(parent, RecordKeyValueNode.class);
        if (recordKeyValueNode == null) {
            PsiElement prevVisibleSibling = PsiTreeUtil.prevVisibleLeaf(element);
            if (prevVisibleSibling != null && "{".equals(prevVisibleSibling.getText())) {
                FunctionDefinitionNode functionDefinitionNode = PsiTreeUtil.getParentOfType(element, FunctionDefinitionNode.class);
                if (functionDefinitionNode != null) {
                    // Todo - change method
                    addOtherTypeAsLookup(result);
                    addXmlnsAsLookup(result);
                    addValueTypesAsLookups(result);
                    addReferenceTypesAsLookups(result);
                    result.addAllElements(getFunctionSpecificKeywords());
                    result.addAllElements(getCommonKeywords());
                    result.addAllElements(getValueKeywords());
                }
                ServiceBodyNode serviceBodyNode = PsiTreeUtil.getParentOfType(element, ServiceBodyNode.class);
                if (serviceBodyNode != null) {
                    result.addAllElements(getServiceSpecificKeywords());
                }
                ConnectorBodyNode connectorBodyNode = PsiTreeUtil.getParentOfType(element, ConnectorBodyNode.class);
                if (connectorBodyNode != null) {
                    result.addAllElements(getConnectorSpecificKeywords());
                }
            } else if (prevVisibleSibling != null && "}".equals(prevVisibleSibling.getText())) {
                result.addAllElements(getFileLevelKeywordsAsLookups(true, false, false));
            }
        }
    }
    if (parent instanceof ResourceDefinitionNode) {
        result.addAllElements(getServiceSpecificKeywords());
    }
    if (parent.getPrevSibling() == null) {
        GlobalVariableDefinitionNode globalVariableDefinitionNode = PsiTreeUtil.getParentOfType(element, GlobalVariableDefinitionNode.class);
        if (globalVariableDefinitionNode != null) {
            PsiElement prevVisibleSibling = PsiTreeUtil.prevVisibleLeaf(element);
            if (prevVisibleSibling != null && !(";".equals(prevVisibleSibling.getText()))) {
                if (!(prevVisibleSibling.getText().matches("[:=]") || prevVisibleSibling instanceof IdentifierPSINode || "create".equals(prevVisibleSibling.getText()))) {
                    if (prevVisibleSibling instanceof LeafPsiElement) {
                        IElementType elementType = ((LeafPsiElement) prevVisibleSibling).getElementType();
                        if (BallerinaParserDefinition.KEYWORDS.contains(elementType)) {
                            return;
                        }
                    }
                    result.addAllElements(getCommonKeywords());
                }
                return;
            }
            PsiElement definitionNode = globalVariableDefinitionNode.getParent();
            PackageDeclarationNode prevPackageDeclarationNode = PsiTreeUtil.getPrevSiblingOfType(definitionNode, PackageDeclarationNode.class);
            ImportDeclarationNode prevImportDeclarationNode = PsiTreeUtil.getPrevSiblingOfType(definitionNode, ImportDeclarationNode.class);
            ConstantDefinitionNode prevConstantDefinitionNode = PsiTreeUtil.getPrevSiblingOfType(definitionNode, ConstantDefinitionNode.class);
            DefinitionNode prevDefinitionNode = PsiTreeUtil.getPrevSiblingOfType(definitionNode, DefinitionNode.class);
            GlobalVariableDefinitionNode prevGlobalVariableDefinition = PsiTreeUtil.findChildOfType(prevDefinitionNode, GlobalVariableDefinitionNode.class);
            if (prevPackageDeclarationNode == null && prevImportDeclarationNode == null && prevConstantDefinitionNode == null && prevGlobalVariableDefinition == null) {
                result.addAllElements(getFileLevelKeywordsAsLookups(true, true, true));
            } else if ((prevPackageDeclarationNode != null || prevImportDeclarationNode != null) && prevConstantDefinitionNode == null && prevGlobalVariableDefinition == null) {
                result.addAllElements(getFileLevelKeywordsAsLookups(true, false, true));
            } else {
                result.addAllElements(getFileLevelKeywordsAsLookups(true, false, false));
            }
            addTypeNamesAsLookups(result);
        }
    }
    if (element instanceof IdentifierPSINode) {
        PsiReference reference = element.findReferenceAt(element.getTextLength());
        if (reference instanceof WorkerReference) {
            result.addAllElements(getWorkerInteractionKeywords());
        }
    }
}
Also used : RecordKeyValueNode(org.ballerinalang.plugins.idea.psi.RecordKeyValueNode) NameReference(org.ballerinalang.plugins.idea.psi.references.NameReference) ConstantDefinitionNode(org.ballerinalang.plugins.idea.psi.ConstantDefinitionNode) ImportDeclarationNode(org.ballerinalang.plugins.idea.psi.ImportDeclarationNode) LeafPsiElement(com.intellij.psi.impl.source.tree.LeafPsiElement) FunctionDefinitionNode(org.ballerinalang.plugins.idea.psi.FunctionDefinitionNode) IdentifierPSINode(org.ballerinalang.plugins.idea.psi.IdentifierPSINode) WorkerReference(org.ballerinalang.plugins.idea.psi.references.WorkerReference) PsiElement(com.intellij.psi.PsiElement) LeafPsiElement(com.intellij.psi.impl.source.tree.LeafPsiElement) ServiceBodyNode(org.ballerinalang.plugins.idea.psi.ServiceBodyNode) AnnotationAttachmentNode(org.ballerinalang.plugins.idea.psi.AnnotationAttachmentNode) ConnectorBodyNode(org.ballerinalang.plugins.idea.psi.ConnectorBodyNode) PsiReference(com.intellij.psi.PsiReference) StatementNode(org.ballerinalang.plugins.idea.psi.StatementNode) ANTLRPsiNode(org.antlr.jetbrains.adaptor.psi.ANTLRPsiNode) ConnectorDefinitionNode(org.ballerinalang.plugins.idea.psi.ConnectorDefinitionNode) PackageDeclarationNode(org.ballerinalang.plugins.idea.psi.PackageDeclarationNode) IElementType(com.intellij.psi.tree.IElementType) PsiErrorElement(com.intellij.psi.PsiErrorElement) ResourceDefinitionNode(org.ballerinalang.plugins.idea.psi.ResourceDefinitionNode) AnnotationDefinitionNode(org.ballerinalang.plugins.idea.psi.AnnotationDefinitionNode) ServiceDefinitionNode(org.ballerinalang.plugins.idea.psi.ServiceDefinitionNode) DefinitionNode(org.ballerinalang.plugins.idea.psi.DefinitionNode) ConstantDefinitionNode(org.ballerinalang.plugins.idea.psi.ConstantDefinitionNode) ConnectorDefinitionNode(org.ballerinalang.plugins.idea.psi.ConnectorDefinitionNode) FunctionDefinitionNode(org.ballerinalang.plugins.idea.psi.FunctionDefinitionNode) GlobalVariableDefinitionNode(org.ballerinalang.plugins.idea.psi.GlobalVariableDefinitionNode) ResourceDefinitionNode(org.ballerinalang.plugins.idea.psi.ResourceDefinitionNode) ServiceDefinitionNode(org.ballerinalang.plugins.idea.psi.ServiceDefinitionNode) ExpressionNode(org.ballerinalang.plugins.idea.psi.ExpressionNode) TypeNameNode(org.ballerinalang.plugins.idea.psi.TypeNameNode) AnnotationDefinitionNode(org.ballerinalang.plugins.idea.psi.AnnotationDefinitionNode) NameReferenceNode(org.ballerinalang.plugins.idea.psi.NameReferenceNode) GlobalVariableDefinitionNode(org.ballerinalang.plugins.idea.psi.GlobalVariableDefinitionNode)

Example 43 with LeafPsiElement

use of com.intellij.psi.impl.source.tree.LeafPsiElement in project ballerina by ballerina-lang.

the class BallerinaPsiImplUtil method isVarAssignmentStatement.

public static boolean isVarAssignmentStatement(@NotNull AssignmentStatementNode assignmentStatementNode) {
    PsiElement firstChild = assignmentStatementNode.getFirstChild();
    if (!(firstChild instanceof LeafPsiElement)) {
        return false;
    }
    IElementType elementType = ((LeafPsiElement) firstChild).getElementType();
    return elementType == BallerinaTypes.VAR;
}
Also used : IElementType(com.intellij.psi.tree.IElementType) LeafPsiElement(com.intellij.psi.impl.source.tree.LeafPsiElement) PsiElement(com.intellij.psi.PsiElement) LeafPsiElement(com.intellij.psi.impl.source.tree.LeafPsiElement)

Example 44 with LeafPsiElement

use of com.intellij.psi.impl.source.tree.LeafPsiElement in project ballerina by ballerina-lang.

the class BallerinaPsiImplUtil method getMatchingElementsFromAFile.

public static <T extends PsiElement> List<IdentifierPSINode> getMatchingElementsFromAFile(@NotNull PsiFile psiFile, @NotNull Class<T> clazz, boolean includePrivate) {
    List<IdentifierPSINode> results = new ArrayList<>();
    Collection<T> definitions = PsiTreeUtil.findChildrenOfType(psiFile, clazz);
    for (T definition : definitions) {
        PsiElement firstChild = definition.getFirstChild();
        if (!includePrivate) {
            if (firstChild instanceof LeafPsiElement) {
                IElementType elementType = ((LeafPsiElement) firstChild).getElementType();
                if (elementType != BallerinaTypes.PUBLIC) {
                    continue;
                }
            } else {
                // is not present.
                continue;
            }
        }
        IdentifierPSINode identifier = PsiTreeUtil.getChildOfType(definition, IdentifierPSINode.class);
        results.add(identifier);
    }
    return results;
}
Also used : IElementType(com.intellij.psi.tree.IElementType) LeafPsiElement(com.intellij.psi.impl.source.tree.LeafPsiElement) IdentifierPSINode(org.ballerinalang.plugins.idea.psi.IdentifierPSINode) ArrayList(java.util.ArrayList) PsiElement(com.intellij.psi.PsiElement) LeafPsiElement(com.intellij.psi.impl.source.tree.LeafPsiElement)

Example 45 with LeafPsiElement

use of com.intellij.psi.impl.source.tree.LeafPsiElement in project ballerina by ballerina-lang.

the class BallerinaParameterInfoHandler method getCurrentParameterIndex.

public static int getCurrentParameterIndex(@NotNull Object o, int offset) {
    // This method updates parameter index node. This will be used to highlight the current parameter in the
    // parameter popup.
    PsiElement element;
    // If the object is a type of ExpressionListNode, cast the object.
    if (o instanceof ExpressionListNode) {
        element = ((ExpressionListNode) o);
    } else if (o instanceof FunctionReferenceNode) {
        PsiElement parent = ((FunctionReferenceNode) o).getParent();
        ExpressionListNode expressionListNode = PsiTreeUtil.getChildOfType(parent, ExpressionListNode.class);
        if (expressionListNode == null) {
            return 0;
        }
        PsiElement[] children = expressionListNode.getChildren();
        return children.length / 2;
    } else if (o instanceof ConnectorReferenceNode) {
        PsiElement parent = ((ConnectorReferenceNode) o).getParent();
        ExpressionListNode expressionListNode = PsiTreeUtil.getChildOfType(parent, ExpressionListNode.class);
        if (expressionListNode == null) {
            return 0;
        }
        PsiElement[] children = expressionListNode.getChildren();
        return children.length / 2;
    } else if (o instanceof IdentifierPSINode) {
        StatementNode statementNode = PsiTreeUtil.getParentOfType((IdentifierPSINode) o, StatementNode.class);
        if (statementNode == null) {
            return 0;
        }
        PsiFile containingFile = statementNode.getContainingFile();
        PsiElement elementAtOffset = containingFile.findElementAt(offset);
        if (elementAtOffset == null) {
            return 0;
        }
        int count = 0;
        int commas = 0;
        PsiElement prevVisibleLeaf = PsiTreeUtil.prevVisibleLeaf(elementAtOffset);
        do {
            if (prevVisibleLeaf != null) {
                if (prevVisibleLeaf.getText().matches("[,]")) {
                    count++;
                    commas++;
                } else if (prevVisibleLeaf.getText().matches("[}]")) {
                    count++;
                } else if (prevVisibleLeaf.getText().matches("[{]")) {
                    count = count - commas;
                } else if ("(".equals(prevVisibleLeaf.getText())) {
                    break;
                }
                prevVisibleLeaf = PsiTreeUtil.prevVisibleLeaf(prevVisibleLeaf);
            }
        } while (prevVisibleLeaf != null);
        return count;
    } else {
        return 0;
    }
    if (!(o instanceof PsiElement)) {
        return -1;
    }
    // Get the element at offset.
    PsiElement psiElement = ((PsiElement) o).getContainingFile().findElementAt(offset);
    if (psiElement == null) {
        return -1;
    }
    // Get the child nodes of element.
    PsiElement[] children = element.getChildren();
    // If there are no child nodes, set current parameter to 0 and return.
    if (children.length == 0) {
        return 0;
    }
    // If the number of children are not 0, we need to calculate the correct index.
    int index = 0;
    // Iterate through all children.
    for (PsiElement child : children) {
        // Get the offset of the child.
        int childTextOffset = child.getTextOffset();
        // following condition is true. So we set the current parameter and return.
        if (psiElement.getTextOffset() <= childTextOffset) {
            return index;
        }
        // If the child is a LeafPsiElement, increment the index.
        if (child instanceof LeafPsiElement) {
            index++;
        }
    }
    // the calculated current parameter.
    return index;
}
Also used : ExpressionListNode(org.ballerinalang.plugins.idea.psi.ExpressionListNode) LeafPsiElement(com.intellij.psi.impl.source.tree.LeafPsiElement) IdentifierPSINode(org.ballerinalang.plugins.idea.psi.IdentifierPSINode) ConnectorReferenceNode(org.ballerinalang.plugins.idea.psi.ConnectorReferenceNode) FunctionReferenceNode(org.ballerinalang.plugins.idea.psi.FunctionReferenceNode) StatementNode(org.ballerinalang.plugins.idea.psi.StatementNode) PsiFile(com.intellij.psi.PsiFile) PsiElement(com.intellij.psi.PsiElement) LeafPsiElement(com.intellij.psi.impl.source.tree.LeafPsiElement)

Aggregations

LeafPsiElement (com.intellij.psi.impl.source.tree.LeafPsiElement)50 PsiElement (com.intellij.psi.PsiElement)29 Nullable (org.jetbrains.annotations.Nullable)8 IElementType (com.intellij.psi.tree.IElementType)7 Test (org.junit.Test)7 PsiFile (com.intellij.psi.PsiFile)6 TextRange (com.intellij.openapi.util.TextRange)5 ArrayList (java.util.ArrayList)5 List (java.util.List)5 NotNull (org.jetbrains.annotations.NotNull)5 Objects (com.google.common.base.Objects)4 Truth.assertThat (com.google.common.truth.Truth.assertThat)4 PsiUtils (com.google.idea.blaze.base.lang.buildfile.psi.util.PsiUtils)4 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)4 BlazeRunConfigurationProducerTestCase (com.google.idea.blaze.base.run.producer.BlazeRunConfigurationProducerTestCase)4 Info (com.intellij.execution.lineMarker.RunLineMarkerContributor.Info)4 AllIcons (com.intellij.icons.AllIcons)4 PsiReference (com.intellij.psi.PsiReference)3 PsiWhiteSpace (com.intellij.psi.PsiWhiteSpace)3 IdentifierPSINode (org.ballerinalang.plugins.idea.psi.IdentifierPSINode)3