[Geany-Devel] [FT-plugins] Proposed Design

Colomban Wendling lists.ban at xxxxx
Tue Aug 30 13:24:38 UTC 2016

Le 29/08/2016 à 02:47, Matthew Brush a écrit :
> […]
> To give an idea, the registration function called by plugins might look
> something like this:
>     gboolean ftplugin_register_provider(GeanyPlugin*,
>         GeanyFiletypeID, GeanyFiletypeFeature, GCallback, gpointer);

Maybe we could simply use GSignals?  Something like

> geany_object_signals[GCB_EDITOR_AUTOCOMPLETE] = g_signal_new (
> 	"autocomplete",
> 	G_OBJECT_CLASS_TYPE (g_object_class),
> 	0, boolean_handled_accumulator, NULL, NULL,
> 	GEANY_TYPE_EDITOR, G_TYPE_INT /* position */, G_TYPE_STRING /* stem */);

Plugins wanting to provide completion connect to it:

> plugin_signal_connect(plugin, NULL, "autocomplete::C++", handler, ...)

and return TRUE if they handled it, FALSE otherwise.

In the handler, they would call something like:

> void editor_show_autocomplete(GeanyEditor *editor, gint pos, GPtrArray/*<TMTag>*/ items);

Additionally, an API like `editor_emit_autocomplete(GeanyEditor, gint
pos)` might be useful so a plugin can trigger autocompletion in more

Just a though, and seeing some of the questions raised further down
might suggest it's not flexible enough, but using the GSignal mechanism
we already have at hand seemed like at least a good idea to consider.


More information about the Devel mailing list