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;
}
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;
}
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);
}
}
}
}
Aggregations