diff --git a/index.ts b/index.ts index c7a1083..fd070f3 100644 --- a/index.ts +++ b/index.ts @@ -68,13 +68,20 @@ function formatReferences(result: unknown): string { if (!result || !Array.isArray(result)) return "(no references found)"; if (result.length === 0) return "(no references found)"; - return result + const limit = 30; + const shown = result.slice(0, limit); + const formatted = shown .map((loc: any, i: number) => { const file = uriToPath(loc.uri); const range = loc.range; return `${i + 1}. ${file} (${range.start.line + 1}:${range.start.character + 1})`; }) .join("\n"); + + if (result.length > limit) { + return `${formatted}\n\n... and ${result.length - limit} more references (showing first ${limit})`; + } + return formatted; } // Format Completions - Turn completion items into readable text.