Skip to content

references/callers/callees lack --body flag to inline matched symbol bodies #1594

Description

@Widthdom

Summary

references, callers, and callees return symbol locations but no flag to include the matching symbol body inline. A consumer that wants to read the bodies must follow up with one excerpt (or find_in_file) per result, which is N+1 calls and significantly slower over MCP.

Where

  • src/CodeIndex/Cli/QueryCommandRunner.cs:177 (references)
  • src/CodeIndex/Cli/QueryCommandRunner.cs:321 (callers)
  • src/CodeIndex/Cli/QueryCommandRunner.cs:441 (callees)
  • src/CodeIndex/Cli/QueryCommandRunner.cs:563 (impact)

Why it matters

LLM-driven workflows almost always need the body next to the location. Asking for "all callers of X and what each one looks like" should be one round-trip, not 1+N. The same change benefits CLI users piping into less for review.

Suggested approach

Add --body (default off, opt-in) and --snippet-lines N to each of the four commands. Reuse the snippet formatter that search already uses. Apply a per-call output cap so very large fan-outs do not blow up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions