MCPcopy Create free account
hub / github.com/anomalyco/opencode / findDiffLineNumber

Function findDiffLineNumber

packages/session-ui/src/pierre/file-selection.ts:22–34  ·  view source on GitHub ↗
(node: Node | null)

Source from the content-addressed store, hash-verified

20}
21
22export function findDiffLineNumber(node: Node | null): number | undefined {
23 const el = findElement(node)
24 if (!el) return
25
26 const line = el.closest("[data-line], [data-alt-line]")
27 if (!(line instanceof HTMLElement)) return
28
29 const primary = parseInt(line.dataset.line ?? "", 10)
30 if (!Number.isNaN(primary)) return primary
31
32 const alt = parseInt(line.dataset.altLine ?? "", 10)
33 if (!Number.isNaN(alt)) return alt
34}
35
36export function findCodeSelectionSide(node: Node | null): SelectedLineRange["side"] {
37 const el = findElement(node)

Callers

nothing calls this directly

Calls 1

findElementFunction · 0.85

Tested by

no test coverage detected