-
-
Notifications
You must be signed in to change notification settings - Fork 8
No current support for custom auto-complete #131
Description
I'm currently trying to use this crate in a project that needs heavy-duty source code editing. Part of that is a basic auto-complete implementation. It needs to be a bit more context-sensitive than the current words-based implementation, but not by much. I've decided what algorithms I want to use to do the actual completion, but getting the library to call my code to do the completion and present it to the user seems to currently be impossible. As such, this is a feature request to add the necessary API hooks to make that happen.
While only adding the necessary traits as described in the linked issue is one way of adding this support, ideally, a subclass or interface implementation would not be needed to use these features, as those techniques are cumbersome with GObject in general, but, it would seem, especially so in Rust since one must not only deal with GObject (which is as cumbersome as any C API), but must also deal with the intricacies of the binding at the same time.
As such, I propose a different interface where there is a simple trait that the user can implement, and then pass a dyn
object to the Rust bindings to act in a similar way as the GObject interface, but where it is significantly easier to use because Rust has built-in support for implementing traits. This could be implemented via adding those traits, then creating a Rust implementation that has a Box<dyn TheTraitThatIJustMentioned>
as a member.
While I am willing to attempt this addition myself and PR it, I don't think that I'm the best person to do that. I'm currently new to Rust, GTK/GObject, and these bindings (I've never even used Rust's FFI support), so if I were to do it it would likely have many errors, if I could get it working at all. I do have significant experience with other tools though, such as C without GObject, C++, and some minimal assembly (I once had to write some assembly to call C functions and be called as a C function, without the aid of a compiler, so I am familiar with how FFI probably works despite the fact that I haven't looked into it.).