diff --git a/web/platform/utils/metaphase.ts b/web/platform/utils/metaphase.ts index a7d1247cc7..3c33db8c05 100644 --- a/web/platform/utils/metaphase.ts +++ b/web/platform/utils/metaphase.ts @@ -73,8 +73,8 @@ const isEnumItem = ( return "enum" in item.inner; }; -const removePrefix = (name: string): string => { - return name +const removePrefix = (path: string): string => { + return path .replace(/^(crate::)?stores::/, "") .replace(/^std::collections::/, ""); }; @@ -146,8 +146,8 @@ const generateResolvedPathJsonExample = ( crate: Crate, depth: number, ): JsonExample => { - const { name, id, args } = type.resolved_path; - const cleanName = removePrefix(name); + const { path, id, args } = type.resolved_path; + const cleanName = removePrefix(path); switch (cleanName) { case "Option": return null; @@ -311,7 +311,7 @@ const generateTypeDescription = (type: Type): string => { } if (isResolvedPathType(type)) { - const { name, args } = type.resolved_path; + const { path, args } = type.resolved_path; const getInnerType = (index: number): string => { if (args && "angle_bracketed" in args) { @@ -323,7 +323,7 @@ const generateTypeDescription = (type: Type): string => { return "Unknown"; }; - const finalTypeName = removePrefix(name.split("::").pop() || name); + const finalTypeName = removePrefix(path.split("::").pop() || path); switch (finalTypeName) { case "Option": diff --git a/web/platform/utils/rustdoc_types.ts b/web/platform/utils/rustdoc_types.ts index 05d8d54c7e..624d4754c5 100644 --- a/web/platform/utils/rustdoc_types.ts +++ b/web/platform/utils/rustdoc_types.ts @@ -290,7 +290,7 @@ export type Type = }; export interface Path { - name: string; + path: string; id: Id; args: GenericArgs | null; }