MCPcopy Create free account
hub / github.com/andywer/postguard / formatSourceLink

Function formatSourceLink

src/errors.ts:23–32  ·  view source on GitHub ↗
(filePath: string, location?: SourceLocation | null)

Source from the content-addressed store, hash-verified

21}
22
23function formatSourceLink(filePath: string, location?: SourceLocation | null): string {
24 if (location) {
25 const locationString = location.start.column
26 ? `${filePath}:${location.start.line}:${location.start.column + 1}`
27 : `${filePath}:${location.start.line}`
28 return format.sourceReference(locationString)
29 } else {
30 return format.sourceReference(filePath)
31 }
32}
33
34function getLineColumnOffset(text: string, startIndex: number) {
35 const preceedingText = text.substring(0, startIndex)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected