MCPcopy Create free account
hub / github.com/continuedev/continue / getForId

Method getForId

core/indexing/CodeSnippetsIndex.ts:351–369  ·  view source on GitHub ↗
(
    id: number,
    workspaceDirs: string[],
  )

Source from the content-addressed store, hash-verified

349 }
350
351 static async getForId(
352 id: number,
353 workspaceDirs: string[],
354 ): Promise<ContextItem> {
355 const db = await SqliteDb.get();
356 const row = await db.get("SELECT * FROM code_snippets WHERE id = ?", [id]);
357
358 const last2Parts = getLastNUriRelativePathParts(workspaceDirs, row.path, 2);
359 const { relativePathOrBasename } = findUriInDirs(row.path, workspaceDirs);
360 return {
361 name: row.title,
362 description: last2Parts,
363 content: `\`\`\`${relativePathOrBasename}\n${row.content}\n\`\`\``,
364 uri: {
365 type: "file",
366 value: row.path,
367 },
368 };
369 }
370
371 static async getAll(tag: IndexTag): Promise<ContextSubmenuItem[]> {
372 const db = await SqliteDb.get();

Callers 1

getContextItemsMethod · 0.80

Calls 3

findUriInDirsFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected