Set<String> (PsiElement elementAt) { PsiElement parameterList = PsiTreeUtil.getParentOfType(elementAt, PsiParameterList.class, PsiRecordHeader.class); if (parameterList == null) { if (elementAt == null) return null; final PsiElement parent = elementAt.getParent(); if (!(parent instanceof PsiMethod)) return null; parameterList = ((PsiMethod)parent).getParameterList(); } PsiVariable[] allVariables; if (parameterList instanceof PsiParameterList) { allVariables = ((PsiParameterList)parameterList).getParameters(); } else if (parameterList instanceof PsiRecordHeader) { allVariables = ((PsiRecordHeader)parameterList).getRecordComponents(); } else { return null; } PsiVariable parameter = PsiTreeUtil.getParentOfType(elementAt, PsiVariable.class); Set<String> parameterNames = new HashSet<>(); for (PsiVariable psiParameter : allVariables) { if (psiParameter == parameter) continue; parameterNames.add(psiParameter.getName()); } return parameterNames; }