feat: add cwd-aware auto_suggestions option#55
Merged
Conversation
Change auto_suggestions from bool to enum with three modes: - "none": Disable suggestions - "all": Show suggestions from all history (default, backward compatible) - "cwd": Show suggestions only from current directory history The cwd mode filters history entries by the directory where they were recorded, falling back to all history if no matches found. This is similar to fish shell's directory-aware completions. Backward compatibility is preserved: - true → "all" - false → "none" Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Extract create_r_hinter() helper to eliminate code duplication - Add documentation for shell mode cwd limitation - Add test for invalid auto_suggestions string values - Update JSON schema to accept both boolean and string values Co-Authored-By: Claude Opus 4.5 <[email protected]>
Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR adds a cwd-aware mode to the auto-suggestions feature, changing it from a boolean to an enum with three modes: "none" (disable), "all" (show all history), and "cwd" (show only current directory history). The implementation maintains backward compatibility by accepting boolean values in configuration, with a comprehensive JSON schema that supports both formats.
Changes:
- Introduces
AutoSuggestionsenum with three variants replacing the previous boolean field - Implements custom serialization/deserialization to accept both boolean and string values for backward compatibility
- Refactors
RLanguageHinterto support cwd-aware filtering with fallback to all history - Updates JSON schema, documentation, tests, and snapshots to reflect the new configuration option
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/arf-console/src/config/editor.rs | Adds AutoSuggestions enum with custom serde implementation and JSON schema |
| crates/arf-console/src/editor/hinter.rs | Refactors RLanguageHinter to support cwd-aware filtering |
| crates/arf-console/src/repl/mod.rs | Updates REPL to create appropriate hinter based on config |
| crates/arf-console/src/config/mod.rs | Adds comprehensive tests for new enum parsing |
| docs/configuration.md | Documents the new auto-suggestions modes with examples |
| crates/arf-console/src/config/snapshots/* | Updates snapshots for schema and default config |
| artifacts/arf.schema.json | Updates JSON schema with new enum definition |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Address Copilot review: remove "true"/"false" string aliases from AutoSuggestions deserialization. Boolean values are already handled by visit_bool, so string aliases are unnecessary and potentially confusing. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Update documentation to clearly separate boolean values (true/false) from
string values ("none", "all", "cwd"). Add tests to verify that string
"true"/"false" are rejected (users should use boolean values instead).
Co-Authored-By: Claude Opus 4.5 <[email protected]>
3 tasks
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.
Summary
auto_suggestionsfromboolto enum with three modes:"none": Disable suggestions"all": Show suggestions from all history (default)"cwd": Show suggestions only from current directory historytrue→"all",false→"none")Details
The
"cwd"mode filters history-based suggestions to show only entries recorded in the current working directory, falling back to all history if no matches found. This is similar to fish shell's directory-aware completions.Config example
Note
Shell mode (
#!prefix) always searches all history regardless of this setting.Test plan
AutoSuggestionsparsing (string and boolean values)🤖 Generated with Claude Code