Remove rustyline context from nu's completion context (#2387)

This commit is contained in:
Jason Gedge 2020-08-21 18:21:14 -04:00 committed by GitHub
parent 9f85b10fcb
commit 11352f87f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 11 deletions

View File

@ -13,11 +13,11 @@ pub struct Suggestion {
pub replacement: String,
}
pub struct Context<'a>(&'a context::Context, &'a rustyline::Context<'a>);
pub struct Context<'a>(&'a context::Context);
impl<'a> Context<'a> {
pub fn new(a: &'a context::Context, b: &'a rustyline::Context<'a>) -> Context<'a> {
Context(a, b)
pub fn new(a: &'a context::Context) -> Context<'a> {
Context(a)
}
}
@ -27,12 +27,6 @@ impl<'a> AsRef<context::Context> for Context<'a> {
}
}
impl<'a> AsRef<rustyline::Context<'a>> for Context<'a> {
fn as_ref(&self) -> &rustyline::Context<'a> {
self.1
}
}
pub trait Completer {
fn complete(
&self,

View File

@ -45,9 +45,9 @@ impl rustyline::completion::Completer for Helper {
&self,
line: &str,
pos: usize,
ctx: &rustyline::Context<'_>,
_ctx: &rustyline::Context<'_>,
) -> Result<(usize, Vec<Self::Candidate>), rustyline::error::ReadlineError> {
let ctx = completion::Context::new(&self.context, ctx);
let ctx = completion::Context::new(&self.context);
Ok(self.completer.complete(line, pos, &ctx))
}
}