List<PsiElement> (@NotNull PsiElement elementAt) { PsiVariable psiVariable = getPossibleLocaleVariable(elementAt); if (psiVariable != null) { PsiTypeElement element = psiVariable.getTypeElement(); if (element.isInferredType() && psiVariable.getInitializer() != null && psiVariable.getNameIdentifier() != null) { return Collections.singletonList(elementAt); } } ArrayList<PsiElement> elements = new ArrayList<>(); PsiParameter parameter = getPossibleParameter(elementAt); if (parameter != null) { elements.add(parameter); } elements.addAll(SyntaxTraverser.psiApi().parents(elementAt) .filter(PsiExpression.class) .filter(JavaTypeProvider::isLargestNonTrivialExpression) .map(t -> (PsiElement)t) .toList()); return elements; }