Skip to content

Conversation

@altynbek132
Copy link

@altynbek132 altynbek132 commented Jan 21, 2026

Introduce a new configuration option to start with all files deselected. This change affects the selection engine and allows users to control the initial selection state through command-line arguments and configuration files.

it is helpful for --tui --deselected

Introduce a new configuration option to start with all files deselected. This change affects the selection engine and allows users to control the initial selection state through command-line arguments and configuration files.
Copilot AI review requested due to automatic review settings January 21, 2026 07:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a new configuration option deselected that allows users to start with all files deselected by default. The feature integrates seamlessly with the existing selection system, properly respecting include patterns and user actions while only affecting the default behavior when no patterns match.

Changes:

  • Added deselected boolean field to configuration structures with proper serialization support
  • Extended SelectionEngine to support deselected-by-default behavior
  • Added command-line argument --deselected and UI toggle in the settings panel

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/code2prompt-core/src/configuration.rs Added deselected field to Code2PromptConfig and TomlConfig with proper serialization
crates/code2prompt-core/src/selection.rs Extended SelectionEngine with deselected_by_default field and logic, added test
crates/code2prompt-core/src/session.rs Updated session to pass deselected to SelectionEngine, added set_deselected method
crates/code2prompt/src/args.rs Added --deselected command-line argument
crates/code2prompt/src/config.rs Merged CLI and config file values for deselected option
crates/code2prompt/src/model/settings.rs Added Deselected enum variant and toggle logic
crates/code2prompt/src/view/formatters.rs Added UI display for deselected setting in settings panel

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +318 to +330
#[test]
fn test_deselected_by_default() {
let mut engine = SelectionEngine::new(vec![], vec![], true);

// By default everything is deselected
assert!(!engine.is_selected(Path::new("main.rs")));
assert!(!engine.is_selected(Path::new("src/lib.rs")));

// User action should still work
engine.include_file(PathBuf::from("main.rs"));
assert!(engine.is_selected(Path::new("main.rs")));
assert!(!engine.is_selected(Path::new("src/lib.rs")));
}
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test coverage for the new deselected_by_default feature only covers the case when there are no include patterns. Consider adding a test case to verify the interaction between deselected_by_default=true and include patterns to ensure that include patterns still work as expected when this flag is enabled. For example, when deselected_by_default=true and include_patterns=["*.rs"], files matching "*.rs" should still be selected.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant