Complete commands that start with a slash
(commands: Vec<&'static str>, word: &str, start: usize)
| 160 | |
| 161 | /// Complete commands that start with a slash |
| 162 | fn complete_command(commands: Vec<&'static str>, word: &str, start: usize) -> (usize, Vec<String>) { |
| 163 | ( |
| 164 | start, |
| 165 | commands |
| 166 | .iter() |
| 167 | .filter(|p| p.starts_with(word)) |
| 168 | .map(|s| (*s).to_owned()) |
| 169 | .collect(), |
| 170 | ) |
| 171 | } |
| 172 | |
| 173 | /// A wrapper around FilenameCompleter that provides enhanced path detection |
| 174 | /// and completion capabilities for the chat interface. |