Summary
Add tab completion in the REPL for:
- File paths
- Slash commands (
/help, /clear, etc.)
- Shell escape commands (
!git, !cargo, etc.)
Current State
rustyline supports custom completers via the Completer trait. Clemini currently uses DefaultEditor without custom completion.
Proposed Completions
Slash commands
> /cl<TAB> → /clear
> /st<TAB> → /stats (or cycle: /stats, /status)
File paths (when context suggests a path)
> read src/too<TAB> → read src/tools/
> read src/tools/<TAB> → (shows: bash.rs, edit.rs, ...)
Shell escapes
> !car<TAB> → !cargo
> !cargo bu<TAB> → !cargo build
Implementation Notes
use rustyline::completion::{Completer, Pair};
struct CleminiCompleter {
cwd: PathBuf,
}
impl Completer for CleminiCompleter {
fn complete(&self, line: &str, pos: usize) -> Result<(usize, Vec<Pair>)> {
if line.starts_with('/') {
// Complete slash commands
} else if line.starts_with('!') {
// Complete shell commands
} else {
// Could do path completion for quoted strings
}
}
}
Related
- rustyline
Helper trait combines Completer, Highlighter, Hinter, Validator
Summary
Add tab completion in the REPL for:
/help,/clear, etc.)!git,!cargo, etc.)Current State
rustyline supports custom completers via the
Completertrait. Clemini currently usesDefaultEditorwithout custom completion.Proposed Completions
Slash commands
File paths (when context suggests a path)
Shell escapes
Implementation Notes
Related
Helpertrait combines Completer, Highlighter, Hinter, Validator