Search in sources :

Example 1 with CfmlFunction

use of com.intellij.coldFusion.model.psi.CfmlFunction in project intellij-plugins by JetBrains.

the class CfmlFoldingBuilder method isCollapsedByDefault.

public boolean isCollapsedByDefault(@NotNull ASTNode node) {
    CodeFoldingSettings settings = CodeFoldingSettings.getInstance();
    final PsiElement element = SourceTreeToPsiMap.treeElementToPsi(node);
    if (element instanceof PsiComment) {
        // find out if file header
        final ASTNode parent = node.getTreeParent();
        ASTNode treePrev = node.getTreePrev();
        if (parent.getElementType() == CfmlElementTypes.CFML_FILE && treePrev == null) {
            return CodeFoldingSettings.getInstance().COLLAPSE_FILE_HEADER;
        } else {
            return CodeFoldingSettings.getInstance().COLLAPSE_DOC_COMMENTS;
        }
    } else if (element instanceof CfmlFunction || node.getElementType() == CfmlElementTypes.FUNCTIONBODY) {
        return settings.COLLAPSE_METHODS;
    }
    return false;
}
Also used : CodeFoldingSettings(com.intellij.codeInsight.folding.CodeFoldingSettings) CfmlFunction(com.intellij.coldFusion.model.psi.CfmlFunction) PsiComment(com.intellij.psi.PsiComment) ASTNode(com.intellij.lang.ASTNode) PsiElement(com.intellij.psi.PsiElement)

Example 2 with CfmlFunction

use of com.intellij.coldFusion.model.psi.CfmlFunction in project intellij-plugins by JetBrains.

the class CfmlStructureViewElement method getChildrenBase.

@NotNull
public Collection<StructureViewTreeElement> getChildrenBase() {
    PsiElement element = getElement();
    Collection<StructureViewTreeElement> result = new LinkedList<>();
    if (element != null && (element instanceof CfmlFile || !(element instanceof CfmlFunction))) {
        collectResultsFromChildren(result, element);
    }
    return result;
}
Also used : CfmlFunction(com.intellij.coldFusion.model.psi.CfmlFunction) CfmlFile(com.intellij.coldFusion.model.files.CfmlFile) StructureViewTreeElement(com.intellij.ide.structureView.StructureViewTreeElement) PsiElement(com.intellij.psi.PsiElement) LinkedList(java.util.LinkedList) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with CfmlFunction

use of com.intellij.coldFusion.model.psi.CfmlFunction in project intellij-plugins by JetBrains.

the class CfmlMethodInsertHandler method handleInsert.

public void handleInsert(InsertionContext context, LookupElement lookupElement) {
    Editor editor = context.getEditor();
    if (CfmlPsiUtil.isFunctionDefinition(lookupElement.getObject())) {
        final CfmlFunction function = CfmlPsiUtil.getFunctionDefinition(lookupElement.getObject());
        if (!CfmlInsertHandlerUtil.isStringAtCaret(editor, "(")) {
            CfmlInsertHandlerUtil.insertStringAtCaret(editor, "()");
            if (function.getParameters().length > 0) {
                editor.getCaretModel().moveCaretRelatively(-1, 0, false, false, true);
                showParameterInfo(editor);
            }
        } else {
            if (CfmlInsertHandlerUtil.isStringAtCaret(editor, "()")) {
                editor.getCaretModel().moveCaretRelatively(2, 0, false, false, true);
            } else {
                editor.getCaretModel().moveCaretRelatively(1, 0, false, false, true);
                showParameterInfo(editor);
            }
        }
    }
}
Also used : CfmlFunction(com.intellij.coldFusion.model.psi.CfmlFunction) Editor(com.intellij.openapi.editor.Editor)

Aggregations

CfmlFunction (com.intellij.coldFusion.model.psi.CfmlFunction)3 PsiElement (com.intellij.psi.PsiElement)2 CodeFoldingSettings (com.intellij.codeInsight.folding.CodeFoldingSettings)1 CfmlFile (com.intellij.coldFusion.model.files.CfmlFile)1 StructureViewTreeElement (com.intellij.ide.structureView.StructureViewTreeElement)1 ASTNode (com.intellij.lang.ASTNode)1 Editor (com.intellij.openapi.editor.Editor)1 PsiComment (com.intellij.psi.PsiComment)1 LinkedList (java.util.LinkedList)1 NotNull (org.jetbrains.annotations.NotNull)1