Search in sources :

Example 1 with GoFieldDeclaration

use of com.goide.psi.GoFieldDeclaration in project go-lang-idea-plugin by go-lang-plugin-org.

the class GoFieldNameMacro method fieldNames.

private static Set<String> fieldNames(ExpressionContext context) {
    PsiElement psiElement = context != null ? context.getPsiElementAtStartOffset() : null;
    GoFieldDeclaration fieldDeclaration = PsiTreeUtil.getNonStrictParentOfType(psiElement, GoFieldDeclaration.class);
    if (fieldDeclaration == null) {
        return Collections.emptySet();
    }
    return ContainerUtil.map2LinkedSet(fieldDeclaration.getFieldDefinitionList(), PsiNamedElement::getName);
}
Also used : GoFieldDeclaration(com.goide.psi.GoFieldDeclaration) PsiNamedElement(com.intellij.psi.PsiNamedElement) PsiElement(com.intellij.psi.PsiElement)

Aggregations

GoFieldDeclaration (com.goide.psi.GoFieldDeclaration)1 PsiElement (com.intellij.psi.PsiElement)1 PsiNamedElement (com.intellij.psi.PsiNamedElement)1