mirror of
https://github.com/nushell/nushell.git
synced 2024-11-26 18:33:50 +01:00
Remove rustyline context from nu's completion context (#2387)
This commit is contained in:
parent
9f85b10fcb
commit
11352f87f0
@ -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,
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user