( lines: readonly string[], from: number, highlight: WireHighlight | undefined )
| 115 | * part of the Symbol view counts: real file lines, never offsets into a window. |
| 116 | */ |
| 117 | export 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. |
no test coverage detected