private static @Nullable ASTNode findParent(@NotNull ASTNode element, @NotNull IElementType type) {
    for (ASTNode parent = element.getTreeParent(); parent != null; parent = parent.getTreeParent()) {
      if (is(parent.getElementType(), type)) return parent;
    }
    return null;
  }
private static @Nullable ASTNode findParent(@NotNull ASTNode element, @NotNull IElementType type)