MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / buildFlatList

Function buildFlatList

src/components/referencesPanel/utils.js:41–74  ·  view source on GitHub ↗
(references, symbolName)

Source from the content-addressed store, hash-verified

39}
40
41export async function buildFlatList(references, symbolName) {
42 const grouped = groupReferencesByFile(references);
43
44 const items = [];
45 for (const [uri, fileRefs] of Object.entries(grouped)) {
46 fileRefs.sort((a, b) => a.range.start.line - b.range.start.line);
47
48 items.push({
49 type: "file-header",
50 uri,
51 fileName: getFilename(uri),
52 count: fileRefs.length,
53 });
54
55 for (const ref of fileRefs) {
56 const highlightedText = await highlightLine(
57 ref.lineText || "",
58 uri,
59 symbolName,
60 );
61
62 items.push({
63 type: "reference",
64 uri,
65 ref,
66 line: ref.range.start.line + 1,
67 lineText: ref.lineText || "",
68 highlightedText,
69 symbol: symbolName,
70 });
71 }
72 }
73 return items;
74}
75
76export function createReferenceItem(item, options = {}) {
77 const { collapsedFiles, onToggleFile, onNavigate } = options;

Callers 3

renderReferencesFunction · 0.90
initFunction · 0.90
openReferencesTabFunction · 0.90

Calls 3

highlightLineFunction · 0.90
groupReferencesByFileFunction · 0.85
getFilenameFunction · 0.85

Tested by

no test coverage detected