void (@NotNull PsiElement element, int offsetInElement, @NotNull Consumer<? super PomTarget> consumer) { String name = SpockUtils.getNameByReference(element); if (name == null) return; GrMethod method = PsiTreeUtil.getParentOfType(element, GrMethod.class); if (method == null) return; PsiClass containingClass = method.getContainingClass(); if (containingClass == null) return; if (!InheritanceUtil.isInheritor(containingClass, SpockUtils.SPEC_CLASS_NAME)) return; Map<String, SpockVariableDescriptor> cachedValue = SpockUtils.getVariableMap(method); SpockVariableDescriptor descriptor = cachedValue.get(name); if (descriptor == null) return; if (descriptor.getNavigationElement() == element) { consumer.consume(descriptor.getVariable()); } }