MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / complete_path

Method complete_path

crates/chat-cli/src/cli/chat/prompt.rs:189–206  ·  view source on GitHub ↗

Attempts to complete a file path at the given position in the line

(
        &self,
        line: &str,
        pos: usize,
        os: &Context<'_>,
    )

Source from the content-addressed store, hash-verified

187
188 /// Attempts to complete a file path at the given position in the line
189 pub fn complete_path(
190 &self,
191 line: &str,
192 pos: usize,
193 os: &Context<'_>,
194 ) -> Result<(usize, Vec<String>), ReadlineError> {
195 // Use the filename completer to get path completions
196 match self.filename_completer.complete(line, pos, os) {
197 Ok((pos, completions)) => {
198 // Convert the filename completer's pairs to strings
199 let file_completions: Vec<String> = completions.iter().map(|pair| pair.replacement.clone()).collect();
200
201 // Return the completions if we have any
202 Ok((pos, file_completions))
203 },
204 Err(err) => Err(err),
205 }
206 }
207}
208
209pub struct PromptCompleter {

Callers 1

completeMethod · 0.80

Calls 3

completeMethod · 0.80
mapMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected