Package com.dci.intellij.dbn.language.common.psi

Examples of com.dci.intellij.dbn.language.common.psi.LeafPsiElement


    @Override
    public boolean isInContext(@NotNull PsiFile file, int offset) {
        Language language = file.getLanguage();
        if (language instanceof DBLanguage) {
            // support PSQL in SQL language
            LeafPsiElement leafPsiElement = PsiUtil.lookupLeafBeforeOffset(file, offset);
            if (leafPsiElement != null) {
                if (leafPsiElement.getLanguage() instanceof PSQLLanguage) {
                    return !leafPsiElement.getEnclosingScopePsiElement().getTextRange().contains(offset);
                }
            } else {
                return language instanceof PSQLLanguage;
            }
        }
View Full Code Here


    @Override
    public boolean isInContext(@NotNull PsiFile file, int offset) {
        Language language = file.getLanguage();
        if (language instanceof SQLLanguage) {
            LeafPsiElement leafPsiElement = PsiUtil.lookupLeafBeforeOffset(file, offset);
            if (leafPsiElement != null) {
                if (leafPsiElement.getLanguage() instanceof SQLLanguage) {
                    return !leafPsiElement.getEnclosingScopePsiElement().getTextRange().contains(offset);
                }

            } else {
                return true;
            }
View Full Code Here


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

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


            int invocationCount = parameters.getInvocationCount();
            if (invocationCount > 1) context.setExtended(true);

            if (leafBeforeCaret == null) {
                ElementTypeBundle elementTypeBundle = file.getElementTypeBundle();
                Set<LeafElementType> firstPossibleLeafs = elementTypeBundle.getRootElementType().getLookupCache().getFirstPossibleLeafs();
                for (LeafElementType firstPossibleLeaf : firstPossibleLeafs) {
                    if (firstPossibleLeaf instanceof TokenElementType) {
                        TokenElementType tokenElementType = (TokenElementType) firstPossibleLeaf;
                        if (context.getCodeCompletionFilterSettings().acceptReservedWord(tokenElementType.getTokenTypeCategory())) {
                            LookupItemFactory lookupItemFactory = tokenElementType.getLookupItemFactory(language);
                            lookupItemFactory.createLookupItem(tokenElementType, consumer);
                        }
                    }
                }
            } else {
                leafBeforeCaret = (LeafPsiElement) leafBeforeCaret.getOriginalElement();
                try {
                    buildElementRelativeVariants(leafBeforeCaret, consumer);
                } catch (ConsumerStoppedException e) {

                }
View Full Code Here

            TokenElementType tokenElementType = (TokenElementType) lookupElementObject;
            if(tokenElementType.getTokenType().isReservedWord()) {
                Editor editor = insertionContext.getEditor();
                CaretModel caretModel = editor.getCaretModel();

                LeafPsiElement leafPsiElement = PsiUtil.lookupLeafAtOffset(insertionContext.getFile(), insertionContext.getTailOffset());
                if (leafPsiElement == null || leafPsiElement.getTextOffset() != caretModel.getOffset()) {
                    if (completionChar == '\t' || completionChar == '\u0000' || completionChar == '\n') {
                        insertionContext.getDocument().insertString(insertionContext.getTailOffset(), " ");
                        caretModel.moveCaretRelatively(1, 0, false, false, false);
                    }
                }
View Full Code Here

        TokenElementType separatorToken = psiElement.getElementType().getSeparatorToken();
        PsiElement[] children = psiElement.getChildren();
        int index = 0;
        for (PsiElement child : children) {
            if (child instanceof LeafPsiElement) {
                LeafPsiElement leafPsiElement = (LeafPsiElement) child;

                if (leafPsiElement.getElementType() == separatorToken){
                    index++;
                } else {
                    if (leafs.length == index) {
                        // variant is too short for given QualifiedIdentifier
                        return false;
                    }

                    PsiElement reference = leafPsiElement.resolve();
                    LeafElementType leafElementType = (LeafElementType) leafPsiElement.getElementType();
                    if (reference == null) {
                        if (!(leafElementType.isIdentifier() && leafs[index].isIdentifier()) ||
                                !leafElementType.isSameAs(leafs[index])) {
                            if(child != children[children.length-1]) {
                                return false;
View Full Code Here

TOP

Related Classes of com.dci.intellij.dbn.language.common.psi.LeafPsiElement

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.