Examples of PsiElement


Examples of com.intellij.psi.PsiElement

    lhs.accept(visitor);
    cacheAssignedSymbols(visitor.getUnboundSymbols());
  }

  private void cacheFromUpSetAssignment(final PsiElement upSet) {
    final PsiElement lhs = upSet.getFirstChild();
    UpSetDefinitionSymbolVisitor visitor = new UpSetDefinitionSymbolVisitor();
    lhs.accept(visitor);
    cacheAssignedSymbols(visitor.getUnboundSymbols());
  }
View Full Code Here

Examples of com.intellij.psi.PsiElement

    }
  }

  @Override
  public void visitSymbol(final Symbol symbol) {
    PsiElement id = symbol.getFirstChild();

    if (NAMES.contains(id.getText())) {
      setHighlighting(symbol, myHolder, MathematicaSyntaxHighlighterColors.BUILTIN_FUNCTION);
      return;
    }

    LocalDefinitionResolveProcessor processor = new LocalDefinitionResolveProcessor(symbol);
View Full Code Here

Examples of com.intellij.psi.PsiElement

//      usages.add(element);

      final PsiReference ref = target.getReference();
      if (ref != null) {
        usages.add(ref);
        final PsiElement resolve = ref.resolve();
        if (resolve != null && resolve instanceof Symbol) {
          final Collection<Symbol> symbolsInFile = PsiTreeUtil.findChildrenOfType(target.getContainingFile(), Symbol.class);
          for (Symbol symbol : symbolsInFile) {
            final PsiReference reference = symbol.getReference();
            if (reference != null) {
              final PsiElement resolve1 = reference.resolve();
              if (resolve1 != null && !symbol.equals(resolve1) && resolve.equals(resolve1)) {
                usages.add(reference);
              }
            }
          }
View Full Code Here

Examples of com.intellij.psi.PsiElement

public class CompoundExpressionFixer extends SmartEnterProcessorWithFixers.Fixer<MathematicaSmartEnter> {
  @Override
  public void apply(@NotNull Editor editor, @NotNull MathematicaSmartEnter processor, @NotNull PsiElement element) throws IncorrectOperationException {
    Document doc = editor.getDocument();
    if (element instanceof CompoundExpression && element.getTextOffset()+element.getTextLength() == editor.getCaretModel().getOffset()) {
      final PsiElement lastChild = element.getLastChild();
      if (!lastChild.getNode().getElementType().equals(SEMICOLON)) {
        final int offset = lastChild.getTextOffset() + lastChild.getTextLength();
        doc.insertString(offset, ";\n");
        editor.getCaretModel().moveToOffset(offset + 2);
      }
    }
  }
View Full Code Here

Examples of com.intellij.psi.PsiElement

    int offset = caret == 0 ? 0 : CharArrayUtil.shiftBackward(chars, caret - 1, " \t");
    if (doc.getLineNumber(offset) < doc.getLineNumber(caret)) {
      offset = CharArrayUtil.shiftForward(chars, caret, " \t");
    }

    PsiElement current = psiFile.findElementAt(offset);
    PsiElement saveOriginal = current;
    int steps = 0;
     while (current != null && steps++ < MAX_UPWALK) {
      if (current instanceof List ||
          current instanceof CompoundExpression ||
          current instanceof FunctionCall ||
          current instanceof PsiFile) {

        if (current instanceof List && saveOriginal.getNode().getElementType() == RIGHT_BRACE ||
            current instanceof FunctionCall && saveOriginal.getNode().getElementType() == RIGHT_BRACKET ||
            current instanceof CompoundExpression && saveOriginal.getNode().getElementType() == SEMICOLON) {
          offset += 1;
          current = psiFile.findElementAt(offset);
          saveOriginal = current;
          steps = 0;
          continue;
View Full Code Here

Examples of com.intellij.psi.PsiElement

  }

  @Override
  protected void addCompletions(@NotNull CompletionParameters parameters, ProcessingContext context, @NotNull final CompletionResultSet result) {

    final PsiElement position = parameters.getPosition();
    final PsiElement function = position.getParent().getParent();
    if (function instanceof FunctionCall) {
      String functionName = ((Symbol) function.getFirstChild()).getSymbolName();
      if (ourSymbolInformation.containsKey(functionName) && ourSymbolInformation.get(functionName).function) {
        final SymbolInformationProvider.SymbolInformation functionInformation = ourSymbolInformation.get(functionName);
        final String[] options = functionInformation.options;
        if (options != null) {
          for (String opt : options) {
View Full Code Here

Examples of com.intellij.psi.PsiElement

  @Override
  public Object getCurrentEditorElement() {
    if (myEditor == null) return null;
    final int offset = myEditor.getCaretModel().getOffset();
    final PsiFile file = getPsiFile();
    final PsiElement element = file.getViewProvider().findElementAt(offset, file.getLanguage());
    final PsiElement parent = element != null ? element.getParent() : null;
    if (parent instanceof Symbol) {
      return parent;
    }
    return null;
  }
View Full Code Here

Examples of com.intellij.psi.PsiElement

  @Override
  public void apply(@NotNull Editor editor, @NotNull MathematicaSmartEnter processor, @NotNull PsiElement element) throws IncorrectOperationException {
    Document doc = editor.getDocument();
    if (element instanceof FunctionCall) {

      final PsiElement lastChild = element.getLastChild();
      if (!lastChild.getNode().getElementType().equals(RIGHT_BRACKET)) {
        PsiElement prevSibling = lastChild.getPrevSibling();
        if (prevSibling != null) {
          final int textOffset = prevSibling.getTextOffset();
          if (prevSibling.getNode().getElementType() == COMMA) {
            doc.replaceString(textOffset, textOffset + 1, "]");
          } else {
            doc.insertString(textOffset + prevSibling.getTextLength(), "]");
          }
        }
        return;
      }
      PsiElement prevSibling = lastChild.getPrevSibling();
      while (prevSibling != null && prevSibling instanceof PsiWhiteSpace) {
        prevSibling = prevSibling.getPrevSibling();
      }
      if (prevSibling != null && prevSibling.getNode().getElementType() == COMMA) {
        doc.insertString(prevSibling.getTextOffset() + 1, "\n\n");
        editor.getCaretModel().moveToOffset(prevSibling.getTextOffset() + 2);
        processor.commit(editor);
//          return;
      }
//      editor.getCaretModel().moveToOffset(lastChild.getTextOffset() + 1, true);
View Full Code Here

Examples of com.intellij.psi.PsiElement

          if (child instanceof CompoundExpression) {
            sawCompExpr = true;
            continue;
          }
          if (sawCompExpr) {
            PsiElement errorElement = child.getPrevSibling();
            while (errorElement.getLastChild() != null) {
              errorElement = errorElement.getLastChild();
            }
            holder.registerProblem(errorElement, getStaticDescription(), LocalQuickFix.EMPTY_ARRAY);
          }
        }
      }
View Full Code Here

Examples of com.intellij.psi.PsiElement

    return myAssignment.myAssignmentSymbol != null ? myAssignment.myAssignmentSymbol.getTextOffset() : 0;
  }

  @Override
  public PsiElement getValue() {
    final PsiElement myAssignmentSymbol = myAssignment.myAssignmentSymbol;
    return myAssignmentSymbol.isValid() ? myAssignmentSymbol : null;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.