mirror of
https://github.com/nix-community/noogle.git
synced 2024-11-26 10:24:25 +03:00
improve type proto
This commit is contained in:
parent
f6fe44473f
commit
cf85ab05fc
@ -198,8 +198,8 @@ export function BasicList(props: BasicListProps) {
|
||||
{/* </Stack> */}
|
||||
</Box>
|
||||
<List aria-label="basic-list" sx={{ pt: 0 }}>
|
||||
{items.map(({ item, key }) => (
|
||||
<Box key={key}>
|
||||
{items.map(({ item, key }, idx) => (
|
||||
<Box key={`${key}-${idx}`}>
|
||||
<Slide
|
||||
direction="up"
|
||||
in={key === selected}
|
||||
|
@ -29,7 +29,11 @@ export default function FunctionItem(props: FunctionItemProps) {
|
||||
>
|
||||
<Stack>
|
||||
<ListItemText primary={name} secondary={category} />
|
||||
<Typography>{`${fn_type} `}</Typography>
|
||||
<Typography
|
||||
sx={{
|
||||
color: !fn_type ? "text.secondary" : "text.primary",
|
||||
}}
|
||||
>{`${fn_type || "No type yet provided"} `}</Typography>
|
||||
</Stack>
|
||||
</Paper>
|
||||
);
|
||||
|
@ -89,12 +89,22 @@ export const Preview = (props: PreviewProps) => {
|
||||
}}
|
||||
disableTypography
|
||||
primary={
|
||||
<Typography sx={{ color: "text.secondary" }}>Example</Typography>
|
||||
example && (
|
||||
<Typography sx={{ color: "text.secondary" }}>
|
||||
Example
|
||||
</Typography>
|
||||
)
|
||||
}
|
||||
secondary={
|
||||
example ? (
|
||||
<Box sx={{ mt: -2, pl: 1.5 }}>
|
||||
<Highlight className="nix">{example}</Highlight>
|
||||
</Box>
|
||||
) : (
|
||||
<Typography
|
||||
sx={{ color: "text.secondary" }}
|
||||
>{`no example yet provided`}</Typography>
|
||||
)
|
||||
}
|
||||
/>
|
||||
</ListItem>
|
||||
|
89
flake.lock
89
flake.lock
@ -78,20 +78,22 @@
|
||||
"all-cabal-json": "all-cabal-json",
|
||||
"crane": "crane",
|
||||
"devshell": "devshell",
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-utils-pre-commit": "flake-utils-pre-commit",
|
||||
"ghc-utils": "ghc-utils",
|
||||
"gomod2nix": "gomod2nix",
|
||||
"mach-nix": "mach-nix",
|
||||
"nix-pypi-fetcher": "nix-pypi-fetcher",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"poetry2nix": "poetry2nix",
|
||||
"pre-commit-hooks": "pre-commit-hooks"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1667429039,
|
||||
"narHash": "sha256-Lu6da25JioHzerkLHAHSO9suCQFzJ/XBjkcGCIbasLM=",
|
||||
"lastModified": 1670319715,
|
||||
"narHash": "sha256-W8GEZps6o+eZgMcYfoPbINiaH+yDhKENemgAcqCpu0s=",
|
||||
"owner": "nix-community",
|
||||
"repo": "dream2nix",
|
||||
"rev": "5252794e58eedb02d607fa3187ffead7becc81b0",
|
||||
"rev": "3681e0d5f5ab33a33238642a5fe004d372c66ab7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -123,6 +125,24 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1668450977,
|
||||
"narHash": "sha256-cfLhMhnvXn6x1vPm+Jow3RiFAUSCw/l1utktCw5rVA4=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "d591857e9d7dd9ddbfba0ea02b43b927c3c0f1fa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
@ -216,6 +236,22 @@
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nix-pypi-fetcher": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1669065297,
|
||||
"narHash": "sha256-UStjXjNIuIm7SzMOWvuYWIHBkPUKQ8Id63BMJjnIDoA=",
|
||||
"owner": "DavHau",
|
||||
"repo": "nix-pypi-fetcher",
|
||||
"rev": "a9885ac6a091576b5195d547ac743d45a2a615ac",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "DavHau",
|
||||
"repo": "nix-pypi-fetcher",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixdoc-fork": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
@ -227,11 +263,11 @@
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1670069861,
|
||||
"narHash": "sha256-K+uqDkNkw5W3Rv6kIfJ43htAkhZwqNrVXg+pW6lNez4=",
|
||||
"lastModified": 1670448771,
|
||||
"narHash": "sha256-vO89DbrTBCiV3e3E1cDv8Pldm9D4VRFiJzBx2iTt42c=",
|
||||
"owner": "hsjobeki",
|
||||
"repo": "nixdoc",
|
||||
"rev": "29813f73b02d85c57856afe8bc09d3ab308bfe55",
|
||||
"rev": "9fbc589aef4c0eb256ce9b360fbbc2d1ccf0aa8d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@ -255,18 +291,35 @@
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1669919498,
|
||||
"narHash": "sha256-cndPLdFj2V0OchIgz1sOVKZXOi+ETgSq/OqCCbWsRoo=",
|
||||
"dir": "lib",
|
||||
"lastModified": 1665349835,
|
||||
"narHash": "sha256-UK4urM3iN80UXQ7EaOappDzcisYIuEURFRoGQ/yPkug=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "14c7bd44711b04c05cb78412451005415310b6bd",
|
||||
"rev": "34c5293a71ffdb2fe054eb5288adc1882c1eb0b1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-22.11",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1670448685,
|
||||
"narHash": "sha256-THuBf9WTup5IAPKH36BIRUu3gGbfC1nEbZwXSTGIrMA=",
|
||||
"owner": "hsjobeki",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "eb28895531d354ac9e55fbe721c1182a92c7b28e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hsjobeki",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
@ -290,16 +343,16 @@
|
||||
"poetry2nix": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1632969109,
|
||||
"narHash": "sha256-jPDclkkiAy5m2gGLBlKgH+lQtbF7tL4XxBrbSzw+Ioc=",
|
||||
"lastModified": 1666918719,
|
||||
"narHash": "sha256-BkK42fjAku+2WgCOv2/1NrPa754eQPV7gPBmoKQBWlc=",
|
||||
"owner": "nix-community",
|
||||
"repo": "poetry2nix",
|
||||
"rev": "aee8f04296c39d88155e05d25cfc59dfdd41cc77",
|
||||
"rev": "289efb187123656a116b915206e66852f038720e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"ref": "1.21.0",
|
||||
"ref": "1.36.0",
|
||||
"repo": "poetry2nix",
|
||||
"type": "github"
|
||||
}
|
||||
@ -358,11 +411,11 @@
|
||||
"nixpkgs": "nixpkgs_3"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1670034122,
|
||||
"narHash": "sha256-EqmuOKucPWtMvCZtHraHr3Q3bgVszq1x2PoZtQkUuEk=",
|
||||
"lastModified": 1670380307,
|
||||
"narHash": "sha256-7fJN5ndnE8YbrrtYdqMo3gDV/BW37M4wNBRhjdfP/XY=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "a0d5773275ecd4f141d792d3a0376277c0fc0b65",
|
||||
"rev": "fc98242f5f49d39b8fd3a611c146741a35dc012d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -27,11 +27,26 @@ const search =
|
||||
};
|
||||
|
||||
const preProcess = (a: string | undefined) => {
|
||||
if (a?.match(/\[(.*)\]/)) {
|
||||
return "list";
|
||||
if (a) {
|
||||
let b = a;
|
||||
if (a.includes("::")) {
|
||||
b = a.split("::")[1];
|
||||
}
|
||||
if (a?.toLowerCase()?.includes("attrset")) {
|
||||
return "attrset";
|
||||
const cleaned = b?.replace("(", "").replace(")", "").trim();
|
||||
let typ = cleaned;
|
||||
if (cleaned.match(/\[(.*)\]/)) {
|
||||
typ = "list";
|
||||
}
|
||||
if (
|
||||
cleaned.toLowerCase().includes("attrset") ||
|
||||
cleaned.trim().startsWith("{")
|
||||
) {
|
||||
typ = "attrset";
|
||||
}
|
||||
if (cleaned.length === 1 && ["a", "b", "c", "d", "e"].includes(cleaned)) {
|
||||
typ = "any";
|
||||
}
|
||||
return typ;
|
||||
}
|
||||
return a;
|
||||
};
|
||||
@ -58,6 +73,10 @@ const filter =
|
||||
to.some((t) => parsedOutType?.includes(t))
|
||||
);
|
||||
}
|
||||
//function type could not be detected only show those without filters
|
||||
if (fn_type === null) {
|
||||
return to.includes("any") && from.includes("any");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user