MCPcopy Create free account
hub / github.com/benjitaylor/agentation / formatSourceLocation

Function formatSourceLocation

package/src/utils/source-location.ts:739–758  ·  view source on GitHub ↗
(
  source: SourceLocation,
  format: "path" | "vscode" = "path"
)

Source from the content-addressed store, hash-verified

737 * ```
738 */
739export function formatSourceLocation(
740 source: SourceLocation,
741 format: "path" | "vscode" = "path"
742): string {
743 const { fileName, lineNumber, columnNumber } = source;
744
745 // Build line:column suffix
746 let location = `${fileName}:${lineNumber}`;
747 if (columnNumber !== undefined) {
748 location += `:${columnNumber}`;
749 }
750
751 if (format === "vscode") {
752 // VSCode can open files via URL protocol
753 // Assumes fileName is absolute or can be resolved
754 return `vscode://file${fileName.startsWith("/") ? "" : "/"}${location}`;
755 }
756
757 return location;
758}
759
760/**
761 * Gets source locations for multiple elements at once

Callers 1

detectSourceFileFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…