MCPcopy Create free account
hub / github.com/angular/angular / withProject

Function withProject

ngp-vscode-ng-language-service/server/src/server.ts:239–251  ·  view source on GitHub ↗
(
  handler: (params: P, ctx: HandlerContext) => R | Promise<R>,
)

Source from the content-addressed store, hash-verified

237}
238
239function withProject<P extends {textDocument: {uri: string}}, R>(
240 handler: (params: P, ctx: HandlerContext) => R | Promise<R>,
241): (params: P) => Promise<R | null> {
242 return async (params: P) => {
243 const info = await getProjectInfo(params.textDocument.uri);
244 if (!info) return null;
245 await info.project.hybridCompiler.ensureReady();
246 return handler(params, {
247 languageService: info.project.languageService,
248 documents,
249 });
250 };
251}
252
253connection.onRequest('angular/getTcb', withProject(onGetTcb));
254connection.onHover(withProject(onHover));

Callers 1

server.tsFile · 0.85

Calls 3

getProjectInfoFunction · 0.85
ensureReadyMethod · 0.80
handlerFunction · 0.50

Tested by

no test coverage detected