MCPcopy Index your code
hub / github.com/Acode-Foundation/Acode / createReferenceItem

Function createReferenceItem

src/components/referencesPanel/utils.js:76–108  ·  view source on GitHub ↗
(item, options = {})

Source from the content-addressed store, hash-verified

74}
75
76export function createReferenceItem(item, options = {}) {
77 const { collapsedFiles, onToggleFile, onNavigate } = options;
78
79 if (item.type === "file-header") {
80 const isCollapsed = collapsedFiles?.has(item.uri);
81 const iconClass = helpers.getIconForFile(item.fileName);
82
83 const $el = (
84 <div
85 className={`ref-file-header ${isCollapsed ? "collapsed" : ""}`}
86 onclick={() => onToggleFile?.(item.uri)}
87 >
88 <span className="icon chevron keyboard_arrow_down" />
89 <span className={`${iconClass} file-icon`} />
90 <span className="file-name">{sanitize(item.fileName)}</span>
91 <span className="ref-count">{item.count}</span>
92 </div>
93 );
94
95 return $el;
96 }
97
98 const $el = (
99 <div className="ref-item" onclick={() => onNavigate?.(item.ref)}>
100 <span className="line-number">{item.line}</span>
101 <span className="ref-preview" />
102 </div>
103 );
104
105 $el.get(".ref-preview").innerHTML = DOMPurify.sanitize(item.highlightedText);
106
107 return $el;
108}
109
110export async function navigateToReference(ref) {
111 Sidebar.hide();

Callers 2

renderReferencesListFunction · 0.90
renderListFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected