@Nullable
  private static PsiElement getElementUnderCaret(@NotNull Editor editor, @NotNull PsiFile file) {
    final int offset = TargetElementUtilBase.adjustOffset(file, editor.getDocument(), editor.getCaretModel().getOffset());
    return PyUtil.findNonWhitespaceAtOffset(file, offset);
  }
@Nullable
  private static PsiElement getElementUnderCaret(@NotNull Editor editor, @NotNull PsiFile file)