@techee commented on this pull request.


In src/pluginextension.c:

> +
+	.doc_symbols_provided = func_return_false,
+	.doc_symbols_get = func_return_ptrarr,
+
+	.symbol_highlight_provided = func_return_false
+};
+
+static PluginExtension *current_extension = &dummy_extension;
+
+
+GEANY_API_SYMBOL
+void plugin_extension_register(PluginExtension *extension)
+{
+	/* possibly, in the future if there's a need for multiple extensions,
+	 * have a list of extensions and add/remove to/from the list */
+	current_extension = extension;

Or really just add the list here. What I think in principle should happen is something like this (demonstrated on goto definition/declaration):

gboolean plugin_extension_goto_provided(GeanyDocument *doc)
{
	PluginExtension *extension;
	gint i;

	foreach_ptr_array(extension, i, all_extensions)
	{
		if (extension->goto_provided && extension->goto_provided(doc))
			return TRUE;
	}
	return FALSE;
}


void plugin_extension_goto_perform(GeanyDocument *doc, gint pos, gboolean definition)
{
	PluginExtension *extension;
	gint i;

	foreach_ptr_array(extension, i, all_extensions)
	{
		if (extension->goto_provided && extension->goto_provided(doc))
		{
			extension->goto_perform(doc, pos, definition);
			return;
		}
	}
}

Basically the first item in the list providing the functionality for the document filetype would "win". The perform() of other plugins won't be called. This might require some cooperation among plugins so they allow disabling certain functionality and allow the other plugins do what they want. This is possible with the LSP plugin already where one can set goto_enable=false so plugin_extension_goto_provided() would return FALSE which would allow the other plugin in the list provide the goto feature.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany/pull/3849/review/2094977937@github.com>