You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was messing with rustyline, it's completion API and trying do implement multiline editing at the same time, but then I encountered a problem: I need to have the input from the previous lines to have a proper context for my completion system.
Sorry if it's unclear, here's a quick example:
input> if [ x -eq 1 ];
...> th<tab>
In this case, my completer need to know that there's an if before to be able to complete the then.
My idea was to store the previous lines as context inside the Completer, but currently there is no way of retrieving the completer in use.
A see two ways of doing this: either make the completer field public or add the get_completer and get_completer_mut methods.
For now, I can do it by replacing the current completer with the added context, but I think that would be better by mutating the completer directly.
If there's a better way, please tell me, I'm open to discussion ;-)
The text was updated successfully, but these errors were encountered:
Oooh, I didn't think of that. Unfortunately, while I can keep the ownership of the completer, I cannot modify it, because it would require having a immutable reference and a mutable reference to the completer at the same time (it's the same if I have a mutable owned completer and an immutable reference to it).
I was messing with rustyline, it's completion API and trying do implement multiline editing at the same time, but then I encountered a problem: I need to have the input from the previous lines to have a proper context for my completion system.
Sorry if it's unclear, here's a quick example:
In this case, my completer need to know that there's an
if
before to be able to complete thethen
.My idea was to store the previous lines as context inside the Completer, but currently there is no way of retrieving the completer in use.
A see two ways of doing this: either make the
completer
field public or add theget_completer
andget_completer_mut
methods.For now, I can do it by replacing the current completer with the added context, but I think that would be better by mutating the completer directly.
If there's a better way, please tell me, I'm open to discussion ;-)
The text was updated successfully, but these errors were encountered: