MCPcopy Create free account
hub / github.com/dfinity/ic-repl / complete

Method complete

src/helper.rs:386–406  ·  view source on GitHub ↗
(
        &self,
        line: &str,
        pos: usize,
        ctx: &Context<'_>,
    )

Source from the content-addressed store, hash-verified

384impl Completer for MyHelper {
385 type Candidate = Pair;
386 fn complete(
387 &self,
388 line: &str,
389 pos: usize,
390 ctx: &Context<'_>,
391 ) -> Result<(usize, Vec<Pair>), ReadlineError> {
392 match partial_parse(line, pos, self) {
393 Some((pos, Partial::Call(canister_id, meth))) => {
394 let mut map = self.canister_map.borrow_mut();
395 Ok(match map.get(&self.agent, &canister_id) {
396 Ok(info) => (pos, info.match_method(&meth)),
397 Err(_) => (pos, Vec::new()),
398 })
399 }
400 Some((pos, Partial::Val(v, rest))) => Ok((pos, match_selector(&v, &rest))),
401 _ => match match_type(line, self) {
402 Some(res) => Ok(res),
403 None => self.completer.complete(line, pos, ctx),
404 },
405 }
406 }
407}
408
409fn match_type(line: &str, helper: &MyHelper) -> Option<(usize, Vec<Pair>)> {

Callers

nothing calls this directly

Calls 5

partial_parseFunction · 0.85
match_selectorFunction · 0.85
match_typeFunction · 0.85
getMethod · 0.80
match_methodMethod · 0.80

Tested by

no test coverage detected