Skip to content

find JSON should expose match spans and snippet truncation metadata #3561

Description

@Widthdom

Summary

cdidx find --json returns path, line, column, and snippet text, but it does not expose enough span/truncation metadata for clients to highlight matches or group results reliably.

Current source evidence

  • FileFindResult contains Line, Column, StartLine, EndLine, Snippet, and SnippetTruncated.
  • PendingFileFindMatch tracks match Length, but that length is not emitted.
  • LineWidthFormatter.ClampLines returns truncation detail that is collapsed to a boolean in find results.

Proposed improvement

Expose match length, original line length where available, truncation reason/counts, and an optional grouped-per-file JSON format for repeated matches in the same file.

Acceptance notes

  • Existing line-delimited JSON remains usable.
  • New fields are bounded and documented.
  • Tests cover long-line truncation and multiple matches in one file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions