[gedit-list] Completion Popup



Hi all,

I am updated the page
http://live.gnome.org/GtkSourceView/CompletionPopupDesign with a
better design for the completion popup. You can see it in the section
"Idea/Solution 2: With "populate"".

I paste the content here. What do you think about the design??

------Idea/Solution 2: With "populate"

The second idea i think is better.

We can do a signal like "completion-populate" and raise it when the
popup need obtain data to show. Something like this:

static gboolean
completion_populate_cb(GtkCompletionModel *model, gpointer user_data);

And the user can connect to this signal and, when we raise it, check
if he wants show some items or not. If yes he adds the items to the
model.

We can see some issues here:

   * The user is who determine his own filters: When he get the
completion-populate signal, the must get the current word and filter
if he wants, or perhaps get the language and show all snippets to this
language, or another. The user who connects to the signal is the
responsible of filter his items and add them to the completion model.

---When raise the signal

The problem is: When we should raise the signal. When the user press
"->" is only for C code, "def" is only for Python etc. Snippets and
autocompletion need show when the user press "control+return" or when
the user writes 3 letters...

I think the user should decide when show the completion popup but we
can provide some useful functions to make it easier. Some function
like (the name is for easy read):

   * show_when_3_letters_pressed(): raise signal when the user press 3 letters
   * show_with_keywords(GList *list): a list of words. When the user
writes these words, we raise the signal
   * show_with_control_return(): raise signal when the user press
"control+return"

---Completion Items

IMO, we should add only completion specific objects to the model. I
think it is easier than know the model structure. If we change the
completion item the user can see the change very easy but with a
generic model is more difficult. In Addition, I like add some
functionality to the popup like show a preview of the item content or
a description, light the content if it is language.

---Post processor

When the user selects an item... What we do? We can not insert the
text directly because a user could process the information before
insert in the buffer. And other user wants show a dialog for interact
with the user...

If we create a Completion Item, it can implement a function like:

   *

     item_selected(CompletionPopup *popup)

And the user will decide what he wants to do with the selected item.

We can provide a base TextCompletionItem that only insert the text in
the buffer at the current position.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]