fix(grep): make 'content' the explicit default output mode#33
Open
T0mSIlver wants to merge 1 commit into
Open
Conversation
The schema description claimed output_mode defaults to 'files_with_matches', while grep.md said 'content' is the default and the code fell through to ripgrep's content default without applying -n. Reconcile on 'content' (matching grep.md): set it as the explicit default so line numbers apply, fix the schema description, and add a test asserting the default behavior and documentation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The default
output_modewas advertised inconsistently:Defaults to "files_with_matches".grep.mdsaid"content" ... (default).params.get("output_mode")→None, which fell through every branch inrun_rgto ripgrep's own content default — and skipped applying-n, so default searches had no line numbers.Fix
Reconcile on content (matching
grep.mdand the chosen behavior): defaultoutput_modeto"content"explicitly so context/line-number handling applies, and correct the schema description. Addstests/test_grep_default_mode.pyasserting an omittedoutput_modereturns line-numbered matching lines and that the schema documents thecontentdefault.Paper reference — judgment call
The paper lists output modes as "One of
content,files_with_matches, orcount" (FastContext paper (arXiv:2606.14066), Appendix E "FastContext Explorer: Tool Schemas", p. 19) but specifies no default. We chosecontent(the paper lists it first, and it matchesgrep.md) — a deliberate decision, not paper-mandated.