@Nullable
  public static <T extends PsiElement> T getPsiElementAt(@NotNull Project project,
                                                         @NotNull Class<T> expectedPsiElementClass,
                                                         @Nullable SourcePosition sourcePosition) {
    if (sourcePosition == null) {
      return null;
    }
    return ReadAction.compute(() -> {
      final PsiFile psiFile = sourcePosition.getFile();
      final Document document = psiFile.getViewProvider().getDocument();
      if (document == null) {
        return null;
      }
      final int spOffset = sourcePosition.getOffset();
      if (spOffset < 0) {
        return null;
      }
      final int offset = CharArrayUtil.shiftForward(document.getCharsSequence(), spOffset, " \t");
      return PsiTreeUtil.getParentOfType(psiFile.findElementAt(offset), expectedPsiElementClass, false);
    });
  }
@Nullable
  public static <T extends PsiElement> T getPsiElementAt(@NotNull Project project,
                                                         @NotNull Class<T> expectedPsiElementClass,
                                                         @Nullable SourcePosition sourcePosition)