Skip to content

Commit 4a0fe84

Browse files
jsbattigclaude
andcommitted
Remove chunk truncation from query result display
Fix: Remove 500-character truncation limit in both quiet and verbose query modes to show complete chunks instead of partial content with "... [truncated]". Changes: - Quiet mode: Remove content[:500] truncation, show full chunk content - Verbose mode: Remove content[:500] truncation, show full chunk content - Remove all "... [truncated]" messages - Maintain line number prefixes for full content display Impact: With model-aware chunking (4096 chars for VoyageAI), users now see complete chunks instead of only 12% of content. Dramatically improves search result usability and code context understanding. All 870 tests pass - no functionality broken. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent bbd5c0c commit 4a0fe84

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

src/code_indexer/cli.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,9 +2346,8 @@ def query(
23462346
# Quiet mode - minimal output: score, path with line numbers
23472347
console.print(f"{score:.3f} {file_path_with_lines}")
23482348
if content:
2349-
# Show content with line numbers in quiet mode
2350-
content_to_display = content[:500]
2351-
content_lines = content_to_display.split("\n")
2349+
# Show full content with line numbers in quiet mode (no truncation)
2350+
content_lines = content.split("\n")
23522351

23532352
# Add line number prefixes if we have line start info
23542353
if line_start is not None:
@@ -2359,10 +2358,7 @@ def query(
23592358
content_with_line_numbers = "\n".join(numbered_lines)
23602359
console.print(content_with_line_numbers)
23612360
else:
2362-
console.print(content_to_display)
2363-
2364-
if len(content) > 500:
2365-
console.print("... [truncated]")
2361+
console.print(content)
23662362
console.print() # Empty line between results
23672363
else:
23682364
# Normal verbose mode
@@ -2399,7 +2395,7 @@ def query(
23992395

24002396
# Note: Fixed-size chunking no longer provides semantic metadata
24012397

2402-
# Content preview with line numbers
2398+
# Content display with line numbers (full chunk, no truncation)
24032399
if content:
24042400
# Create content header with line range
24052401
if line_start is not None and line_end is not None:
@@ -2415,9 +2411,8 @@ def query(
24152411
console.print(f"\n{content_header}")
24162412
console.print("─" * 50)
24172413

2418-
# Add line number prefixes to content
2419-
content_to_display = content[:500]
2420-
content_lines = content_to_display.split("\n")
2414+
# Add line number prefixes to full content (no truncation)
2415+
content_lines = content.split("\n")
24212416

24222417
# Add line number prefixes if we have line start info
24232418
if line_start is not None:
@@ -2427,7 +2422,7 @@ def query(
24272422
numbered_lines.append(f"{line_num:3}: {line}")
24282423
content_with_line_numbers = "\n".join(numbered_lines)
24292424
else:
2430-
content_with_line_numbers = content_to_display
2425+
content_with_line_numbers = content
24312426

24322427
# Syntax highlighting if possible (note: syntax highlighting with line numbers is complex)
24332428
if language and language != "unknown":
@@ -2440,9 +2435,6 @@ def query(
24402435
else:
24412436
console.print(content_with_line_numbers)
24422437

2443-
if len(content) > 500:
2444-
console.print("\n... [truncated]")
2445-
24462438
console.print("─" * 50)
24472439

24482440
except Exception as e:

0 commit comments

Comments
 (0)