Search in sources :

Example 1 with Parameter

use of org.elixir_lang.annotator.Parameter in project intellij-elixir by KronicDeth.

the class Variable method icon.

@Contract(pure = true)
@Nullable
private Icon icon(@NotNull PsiElement element) {
    Icon icon = null;
    Parameter parameter = new Parameter(element);
    Parameter.Type parameterType = Parameter.putParameterized(parameter).type;
    if (parameterType != null) {
        icon = Icons.PARAMETER;
    } else {
        icon = Icons.VARIABLE;
    }
    return icon;
}
Also used : Parameter(org.elixir_lang.annotator.Parameter) Contract(org.jetbrains.annotations.Contract) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with Parameter

use of org.elixir_lang.annotator.Parameter in project intellij-elixir by KronicDeth.

the class Variable method color.

/*
     * Private Instance Methods
     */
@Contract(pure = true)
@NotNull
private Color color(@NotNull final PsiElement element) {
    Color color = JBColor.foreground();
    if (isIgnored(element)) {
        color = ElixirSyntaxHighlighter.IGNORED_VARIABLE.getDefaultAttributes().getForegroundColor();
    } else {
        Parameter parameter = new Parameter(element);
        Parameter.Type parameterType = Parameter.putParameterized(parameter).type;
        if (parameterType != null) {
            if (parameterType == Parameter.Type.VARIABLE) {
                color = ElixirSyntaxHighlighter.PARAMETER.getDefaultAttributes().getForegroundColor();
            }
        } else if (isParameterWithDefault(element)) {
            color = ElixirSyntaxHighlighter.PARAMETER.getDefaultAttributes().getForegroundColor();
        } else if (isVariable(element)) {
            color = ElixirSyntaxHighlighter.VARIABLE.getDefaultAttributes().getForegroundColor();
        }
    }
    return color;
}
Also used : JBColor(com.intellij.ui.JBColor) Parameter(org.elixir_lang.annotator.Parameter) Contract(org.jetbrains.annotations.Contract) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Parameter (org.elixir_lang.annotator.Parameter)2 Contract (org.jetbrains.annotations.Contract)2 JBColor (com.intellij.ui.JBColor)1 NotNull (org.jetbrains.annotations.NotNull)1 Nullable (org.jetbrains.annotations.Nullable)1