public static boolean isOutsideModuleAndCodeBlock(@NotNull Editor editor,
                                                    @NotNull PsiFile file) {
    if (PsiUtil.isModuleFile(file)) {
      return false;
    }
    PsiElement element = file.findElementAt(editor.getCaretModel().getOffset());
    return PsiTreeUtil.getParentOfType(element, PsiCodeBlock.class) == null;
  }
public static boolean isOutsideModuleAndCodeBlock(@NotNull Editor editor,
                                                    @NotNull PsiFile file)