GSoC: GNOME Builder: Improving word completion phase 1- 2 mins
Currently, Builder uses word completion from GtkSourceCompletionWords from the GtkSource* module. The idea is to mimick the word completion technique as in Vim Ctrl-p and Ctrl-n from the insertion cursor.
Scanning entities : Current buffer, open buffers and #includes
Basic scan steps:
Find the insertion position in the current buffer. Scan the buffer looking for prefix matches till the end and wrap around.
After wrapping around to the start_iter of the buffer, if you hit relevant #includes, resolve the relative path and scan them.
Display the result in the completion window (GtkSourceCompletionProvider returns the proposal set).
The above process has to be made incremental. In layman terms, we cannot keep scanning the buffers all at once; we need to return back the results in an incremental manner and display them. Otherwise, this might stall the completion window drawing which would be waiting for all the proposals to get in first. In this regard, I learnt more about GdkFrameClock which is a better way to place our bids against the GTK+ drawing cycle.
GdkFrameClock can help us to update and paint every frame i.e. avoid frame drops. Every new frame will get up-to-date results as somewhat opposed to timeouts used. But still we can use timeouts right now along with making the process “incremental”, which would just work fine. Although, going ahead with this, we still need to keep in mind that GdkFrameClock is still a better way to do this.
A bit more verbose model of incremental process:
Thank you Christian Hergert (hergertme) for overall guidance till now. Also thanks to Matthias Clasen (mclasen) for explaining me GTK+ drawing model and Debarshi Ray (rishi) for GdkFrameClock.
More posts follow soon. Lot of things under experimentation. Stay tuned. Happy Hacking. :)