MCPcopy Index your code
hub / github.com/github/copilot-sdk / emitNamespaceMethod

Function emitNamespaceMethod

scripts/codegen/rust.ts:1871–1967  ·  view source on GitHub ↗
(
	out: string[],
	method: RpcMethod,
	holderField: string,
	isSession: boolean,
	defCollections: DefinitionCollections,
)

Source from the content-addressed store, hash-verified

1869}
1870
1871function emitNamespaceMethod(
1872 out: string[],
1873 method: RpcMethod,
1874 holderField: string,
1875 isSession: boolean,
1876 defCollections: DefinitionCollections,
1877): void {
1878 const wireMethod = method.rpcMethod;
1879 const constName = rpcMethodConstName(method);
1880 const lastSegment = wireMethod.split(".").pop()!;
1881 const fnName = toSnakeCase(lastSegment);
1882
1883 const paramsInfo = getMethodParamsInfo(method, defCollections, isSession);
1884 const hasParams = paramsInfo.hasParams;
1885 const paramsTypeName = paramsInfo.typeName;
1886 const resolvedParams = method.params
1887 ? (resolveObjectSchema(method.params, defCollections) ??
1888 resolveSchema(method.params, defCollections) ??
1889 method.params)
1890 : undefined;
1891
1892 const resultTypeName = getResultTypeName(method, defCollections);
1893 const resultSchema = method.result
1894 ? (resolveSchema(method.result, defCollections) ?? method.result)
1895 : undefined;
1896 const returnType = resultTypeName ? resultTypeName : "()";
1897 const resultIsVoid = resultTypeName === null;
1898
1899 const buildDocs = (includeParams: boolean): string[] => {
1900 const docs = rustRpcMethodDocs(
1901 method,
1902 resultSchema,
1903 rustRpcParamsDescription(method, resolvedParams),
1904 includeParams,
1905 );
1906 if (method.deprecated) docs.push(...rustDeprecatedAttributes(" "));
1907 const stability = method.stability;
1908 if (stability === "experimental") {
1909 docs.push(` ///`);
1910 docs.push(
1911 ` /// <div class="warning">`,
1912 );
1913 docs.push(
1914 ` ///`,
1915 );
1916 docs.push(
1917 ` /// **Experimental.** This API is part of an experimental wire-protocol surface`,
1918 );
1919 docs.push(
1920 ` /// and may change or be removed in future SDK or CLI releases. Pin both the`,
1921 );
1922 docs.push(
1923 ` /// SDK and CLI versions if your code depends on it.`,
1924 );
1925 docs.push(
1926 ` ///`,
1927 );
1928 docs.push(

Callers 1

emitNamespaceStructFunction · 0.85

Calls 11

rpcMethodConstNameFunction · 0.85
getMethodParamsInfoFunction · 0.85
resolveObjectSchemaFunction · 0.85
resolveSchemaFunction · 0.85
getResultTypeNameFunction · 0.85
methodUsesInternalSchemaFunction · 0.85
buildDocsFunction · 0.85
pushNamespaceMethodBodyFunction · 0.85
popMethod · 0.80
toSnakeCaseFunction · 0.70
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…