Search in sources :

Example 1 with NameArity

use of org.elixir_lang.navigation.item_presentation.NameArity in project intellij-elixir by KronicDeth.

the class Callback method getPresentation.

/**
     * Returns the presentation of the tree element.
     *
     * @return the element presentation.
     */
@NotNull
@Override
public ItemPresentation getPresentation() {
    Parent parentPresentation = (Parent) modular.getPresentation();
    String location = parentPresentation.getLocatedPresentableText();
    PsiElement[] arguments = ElixirPsiImplUtil.finalArguments(navigationItem);
    assert arguments != null;
    // pseudo-named-arguments
    boolean callback = true;
    Visible.Visibility visibility = Visible.Visibility.PUBLIC;
    boolean overridable = false;
    boolean override = false;
    String name = "?";
    int arity = -1;
    Call headCall = headCall(navigationItem);
    if (headCall != null) {
        name = headCall.functionName();
        arity = headCall.resolvedFinalArity();
    }
    //noinspection ConstantConditions
    return new NameArity(location, callback, time(), visibility, overridable, override, name, arity);
}
Also used : Call(org.elixir_lang.psi.call.Call) Parent(org.elixir_lang.navigation.item_presentation.Parent) NameArity(org.elixir_lang.navigation.item_presentation.NameArity) PsiElement(com.intellij.psi.PsiElement) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with NameArity

use of org.elixir_lang.navigation.item_presentation.NameArity in project intellij-elixir by KronicDeth.

the class CallDefinition method getPresentation.

/**
     * Returns the presentation of the tree element.
     *
     * @return the element presentation.
     */
@NotNull
@Override
public ItemPresentation getPresentation() {
    ItemPresentation itemPresentation = modular.getPresentation();
    String location = null;
    if (itemPresentation instanceof Parent) {
        Parent parentPresentation = (Parent) itemPresentation;
        location = parentPresentation.getLocatedPresentableText();
    }
    // pseudo-named-arguments
    boolean callback = false;
    //noinspection ConstantConditions
    return new NameArity(location, callback, time, visibility(), overridable, override, name, arity);
}
Also used : Parent(org.elixir_lang.navigation.item_presentation.Parent) NameArity(org.elixir_lang.navigation.item_presentation.NameArity) ItemPresentation(com.intellij.navigation.ItemPresentation) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

NameArity (org.elixir_lang.navigation.item_presentation.NameArity)2 Parent (org.elixir_lang.navigation.item_presentation.Parent)2 NotNull (org.jetbrains.annotations.NotNull)2 ItemPresentation (com.intellij.navigation.ItemPresentation)1 PsiElement (com.intellij.psi.PsiElement)1 Call (org.elixir_lang.psi.call.Call)1