MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / tokensByLine

Function tokensByLine

ui/src/lib/highlight.ts:117–131  ·  view source on GitHub ↗
(
  lines: readonly string[],
  from: number,
  highlight: WireHighlight | undefined
)

Source from the content-addressed store, hash-verified

115 * part of the Symbol view counts: real file lines, never offsets into a window.
116 */
117export function tokensByLine(
118 lines: readonly string[],
119 from: number,
120 highlight: WireHighlight | undefined
121): Map<number, Token[]> {
122 const byLine = new Map<number, Token[]>();
123 for (let i = 0; i < lines.length; i++) {
124 const wire = highlight?.lines[i];
125 byLine.set(
126 from + i,
127 wire ? decodeLine(wire, highlight.classes) : plainLine(lines[i] as string)
128 );
129 }
130 return byLine;
131}
132
133/**
134 * The CSS class for a token, or null where the default ink is right.

Callers 2

flowCardSvgFunction · 0.90

Calls 3

decodeLineFunction · 0.85
plainLineFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected