MCPcopy
hub / github.com/codeaashu/claude-code / parseAtMentionedFileLines

Function parseAtMentionedFileLines

src/utils/attachments.ts:2836–2852  ·  view source on GitHub ↗
(
  mention: string,
)

Source from the content-addressed store, hash-verified

2834}
2835
2836export function parseAtMentionedFileLines(
2837 mention: string,
2838): AtMentionedFileLines {
2839 // Parse mentions like "file.txt#L10-20", "file.txt#heading", or just "file.txt"
2840 // Supports line ranges (#L10, #L10-20) and strips non-line-range fragments (#heading)
2841 const match = mention.match(/^([^#]+)(?:#L(\d+)(?:-(\d+))?)?(?:#[^#]*)?$/)
2842
2843 if (!match) {
2844 return { filename: mention }
2845 }
2846
2847 const [, filename, lineStartStr, lineEndStr] = match
2848 const lineStart = lineStartStr ? parseInt(lineStartStr, 10) : undefined
2849 const lineEnd = lineEndStr ? parseInt(lineEndStr, 10) : lineStart
2850
2851 return { filename: filename ?? mention, lineStart, lineEnd }
2852}
2853
2854async function getDiagnosticAttachments(
2855 toolUseContext: ToolUseContext,

Callers 1

processAtMentionedFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected