Package com.intellij.lang

Examples of com.intellij.lang.ASTNode


    //
    // Function definition/call
    //
    if (elementType == PARAMETER_LIST || elementType == EXPRESSION_LIST) {
      final ASTNode parent = myNode.getTreeParent();
      if (parent == null) {
        return defaultWrap;
      }
      final IElementType parentType = parent.getElementType();
      if (parentType == CALL_EXPRESSION &&
          mySettings.CALL_PARAMETERS_WRAP != CommonCodeStyleSettings.DO_NOT_WRAP) {
        if (myNode.getFirstChildNode() == child) {
          return createWrap(mySettings.CALL_PARAMETERS_LPAREN_ON_NEXT_LINE);
        }
View Full Code Here


      return null;
    }

    final IElementType elementType = myNode.getElementType();
    final IElementType parentType = myNode.getTreeParent() == null ? null : myNode.getTreeParent().getElementType();
    final ASTNode node1 = ((AbstractBlock)child1).getNode();
    final IElementType type1 = node1.getElementType();
    final ASTNode node2 = ((AbstractBlock)child2).getNode();
    final IElementType type2 = node2.getElementType();
    final ASTNode nodeNode1 = node1 == null ? null : node1.getFirstChildNode();
    final IElementType typeType1 = nodeNode1 == null ? null : nodeNode1.getElementType();
    final ASTNode nodeNode2 = node2 == null ? null : node2.getFirstChildNode();
    final IElementType typeType2 = nodeNode2 == null ? null : nodeNode2.getElementType();

    if (type1 == IMPORT_STATEMENT_REGULAR ||
        type1 == IMPORT_STATEMENT_WITH_IN_SUPPORT ||
        type1 == IMPORT_STATEMENT_WITH_WILDCARD ||
        type1 == PACKAGE_STATEMENT ||
View Full Code Here

    return true;
  }

  @Override
  public PsiLanguageInjectionHost updateText(@NotNull String text) {
    ASTNode node = getNode();
    ASTNode parent = node.getTreeParent();
    final HaxeVarDeclarationPart varDeclarationPart = HaxeElementGenerator.createVarDeclarationPart(getProject(), "a=" + text);
    final HaxeVarInit varInit = varDeclarationPart.getVarInit();
    final ASTNode outerNode = varInit == null ? null : varInit.getNode();
    assert outerNode != null;
    parent.replaceChild(node, outerNode);

    return (PsiLanguageInjectionHost)outerNode.getPsi();
  }
View Full Code Here

      return;
    }

    HaxeClass haxeClass = (HaxeClass)psiElement;

    ASTNode node = haxeClass.getNode().findChildByType(HaxeTokenTypes.PLCURLY);

    HaxeComponentName haxeClassComponentName = haxeClass.getComponentName();

    if (node == null && haxeClassComponentName != null) {
      int offset = haxeClassComponentName.getTextRange().getEndOffset();
View Full Code Here

      final TextAttributesKey attribute = getAttributeByType(HaxeComponentType.typeOf(element.getParent()), isStatic);
      if (attribute != null) {
        holder.createInfoAnnotation(node, null).setTextAttributes(attribute);
      }
    }
    final ASTNode astNode = node.getNode();
    if (astNode != null) {
      IElementType tt = astNode.getElementType();

      if (tt == HaxeTokenTypeSets.PPEXPRESSION) {
        annotateCompilationExpression(node, holder);
      }
    }
View Full Code Here

  }

  @Nullable
  public static ASTNode getPrevSiblingSkipWhiteSpacesAndComments(@Nullable ASTNode sibling) {
    if (sibling == null) return null;
    ASTNode result = sibling.getTreePrev();
    while (result != null && isWhitespaceOrComment(result.getPsi())) {
      result = result.getTreePrev();
    }
    return result;
  }
View Full Code Here

    if (elements.length == 0) return null;

    PsiElement element1 = elements[0];
    final PsiElement newStmt = doSurroundElements(elements, element1.getParent());

    ASTNode parentNode = element1.getParent().getNode();
    if (elements.length > 1) {
      parentNode.removeRange(element1.getNode().getTreeNext(), elements[elements.length - 1].getNode().getTreeNext());
    }
    parentNode.replaceChild(element1.getNode(), newStmt.getNode());

    return getSurroundSelectionRange(newStmt);
  }
View Full Code Here

public class NginxFormattingModelBuilder implements FormattingModelBuilder {

    @NotNull
    public FormattingModel createModel(PsiElement element, CodeStyleSettings settings) {

        ASTNode node = element.getNode();
        assert node != null;
        PsiFile containingFile = element.getContainingFile();
        ASTNode astNode = containingFile.getNode();
        assert astNode != null;

        return FormattingModelProvider.createFormattingModelForPsiFile(containingFile, new NginxBlock(node, Indent.getAbsoluteNoneIndent(), null), settings);

    }
View Full Code Here

        if (node.getElementType() == NginxElementTypes.FILE) {
            node.getPsi().getFirstChild();
        }

        ASTNode child = node.getFirstChildNode();
        while (child != null) {
            child = doAppend(child, document, descriptors).getTreeNext();
        }

        return node;
View Full Code Here

        return getDirectiveName().getText();
    }

    @NotNull
    public NginxDirectiveName getDirectiveName() {
        ASTNode nameNode = getNode().findChildByType(NginxElementTypes.CONTEXT_NAME);
        if (nameNode == null) {
            nameNode = getNode().findChildByType(NginxElementTypes.DIRECTIVE_NAME);
        }
        //is npe really probable here?
        return (NginxDirectiveName) nameNode.getPsi();
    }
View Full Code Here

TOP

Related Classes of com.intellij.lang.ASTNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.