Examples of findElementAt()


Examples of com.dci.intellij.dbn.language.common.DBLanguageFile.findElementAt()

            CodeCompletionLookupConsumer consumer = new CodeCompletionLookupConsumer(context);
            DBLanguage language = context.getLanguage();


            int caretOffset = parameters.getOffset();
            if (file.findElementAt(caretOffset) instanceof PsiComment) return;

            LeafPsiElement leafBeforeCaret = PsiUtil.lookupLeafBeforeOffset(file, caretOffset);


            int invocationCount = parameters.getInvocationCount();
View Full Code Here

Examples of com.intellij.psi.FileViewProvider.findElementAt()

    if (provider instanceof HbFileViewProvider) {
      if (HbConfig.isAutocompleteMustachesEnabled() && c == '}' && !previousChar.equals("}")) {
        // we may be able to complete the second brace
        PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
        PsiElement elementAt = provider.findElementAt(offset - 1, HbLanguage.class);
        ASTNode node = elementAt != null ? elementAt.getNode() : null;
        if (node != null && node.getElementType() == HbTokenTypes.INVALID) {
          // we should be looking at the beginning of a close brace.  Find its matching open brace and auto-complete based on its type
          PsiElement mustache = PsiTreeUtil.findFirstParent(elementAt, new Condition<PsiElement>() {
            @Override
View Full Code Here

Examples of com.intellij.psi.FileViewProvider.findElementAt()

  private static PsiElement getCfmlElementAtOffset(int offset, PsiFile file) {
    final FileViewProvider fileViewProvider = file.getViewProvider();
    file = fileViewProvider.getPsi(fileViewProvider.getBaseLanguage());
    final Language cfmlLanguage = file.getLanguage();

    return fileViewProvider.findElementAt(offset, cfmlLanguage);
  }

  private static int skipWhiteSpaces(int offset, PsiFile file) {
    PsiElement at = getCfmlElementAtOffset(offset, file);
    if (at != null && at.getNode().getElementType() == CfmlTokenTypes.WHITE_SPACE) {
View Full Code Here

Examples of com.intellij.psi.FileViewProvider.findElementAt()

    if (provider instanceof HbFileViewProvider) {
      if (HbConfig.isAutocompleteMustachesEnabled() && c == '}' && !previousChar.equals("}")) {
        // we may be able to complete the second brace
        PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
        PsiElement elementAt = provider.findElementAt(offset - 1, provider.getBaseLanguage());
        ASTNode node = elementAt != null ? elementAt.getNode() : null;
        if (node != null && node.getElementType() == HbTokenTypes.INVALID) {
          // we should be looking at the beginning of a close brace.  Find its matching open brace and auto-complete based on its type
          PsiElement mustache = PsiTreeUtil.findFirstParent(elementAt, new Condition<PsiElement>() {
            @Override
View Full Code Here

Examples of com.intellij.psi.FileViewProvider.findElementAt()

    PsiElement elementAt = PsiTreeUtil.findElementOfClassAtRange(file, startOffset, endOffset, CfmlReferenceExpression.class);
    if (elementAt != null) {
      return !(elementAt.getParent() instanceof CfmlReferenceExpression) ? new PsiElement[]{elementAt} : PsiElement.EMPTY_ARRAY;
    }
    for (Language language : viewProvider.getLanguages()) {
      elementAt = viewProvider.findElementAt(startOffset, language);
      if (elementAt != null &&
          (!language.is(CfmlLanguage.INSTANCE) || elementAt.getNode().getElementType() == CfmlTokenTypes.STRING_TEXT) &&
          elementAt.getNode().getText().matches("(\\S)+")
          &&
          elementAt.getTextRange().getStartOffset() == startOffset &&
View Full Code Here

Examples of com.intellij.psi.FileViewProvider.findElementAt()

  public Object getCurrentEditorElement() {
    if (myEditor == null) return null;
    final int offset = myEditor.getCaretModel().getOffset();
    FileViewProvider viewProvider = getPsiFile().getViewProvider();
    PsiElement element = viewProvider.findElementAt(offset, getPsiFile().getLanguage());
    while (element != null && !(element instanceof PsiFile)) {
      if (isSuitable(element)) return element;
      element = element.getParent();
    }
    return null;
View Full Code Here

Examples of com.intellij.psi.PsiFile.findElementAt()

    assert project != null;
    final PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
    assert psiFile != null;

    //region Interesting part where I track down usages
    PsiElement element = psiFile.findElementAt(editor.getCaretModel().getOffset());
    element = (element != null) ? element.getParent() : null;
    final List<PsiElement> usages = new ArrayList<PsiElement>();
    if (element instanceof Symbol) {
//      usages.add(element);
View Full Code Here

Examples of com.intellij.psi.PsiFile.findElementAt()

            return null;
        PsiFile declarationModulePsiFile = PsiManager.getInstance(project).findFile(declarationModuleVirtualFile);
        if (declarationModulePsiFile == null)
            return null;
        int declarationStart = declaration.coord.getOffset(declarationModulePsiFile);
        PsiElement elementAt = declarationModulePsiFile.findElementAt(declarationStart);
        if (elementAt == null)
            return null;
        ASTNode parentNode = elementAt.getParent().getNode();
        if (parentNode.getElementType() == HaskellElementTypes.INFIX_PREFIX_IDENT) {
            return new HPInfixPrefixIdentImpl(parentNode);
View Full Code Here

Examples of com.intellij.psi.PsiFile.findElementAt()


    public static boolean introduceWhitespace(PsiFile file, int caretOffset) {
        PsiFile originalFile = file.getOriginalFile();
        if (originalFile != null && originalFile != file) {
            PsiElement elementAtCaret = originalFile.findElementAt(caretOffset);
            return !(elementAtCaret instanceof PsiWhiteSpace) || elementAtCaret.getNextSibling() == null;
        }
        return false;
    }
View Full Code Here

Examples of com.intellij.psi.PsiFile.findElementAt()

    final Editor editor = DataKeys.EDITOR.getData(dataContext);


    final PsiFile psiFile = getPsiFile(dataContext);
    if (editor != null && psiFile != null) {
      return psiFile.findElementAt(editor.getCaretModel().getOffset());
    }
    // Unable to find currentElement
    return 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.