public static @Nullable PsiRecordComponent getComponentForCanonicalConstructorParameter(@NotNull PsiParameter parameter) {
    if (parameter instanceof LightCompactConstructorParameter) {
      return ((LightCompactConstructorParameter)parameter).getRecordComponent();
    }
    PsiClass aClass = PsiTreeUtil.getParentOfType(parameter, PsiClass.class);
    if (aClass == null) return null;
    String parameterName = parameter.getName();
    return Stream.of(aClass.getRecordComponents())
      .filter(component -> parameterName.equals(component.getName()))
      .findFirst()
      .orElse(null);
  }
public static @Nullable PsiRecordComponent getComponentForCanonicalConstructorParameter(@NotNull PsiParameter parameter)