@techee commented on this pull request.
- gboolean (*goto_perform)(GeanyDocument *doc, gint pos, gboolean definition, gpointer data);
+ + /** + * Pointer to function called by Geany to check whether the plugin implements + * additional symbol (e.g. type) highlighting in Scintilla. + * + * @see @c autocomplete_provided() for more details. + * @note There is no function in the @c PluginExtension structure informing + * plugins to perform symbol highlighting. Plugins + * implementing symbol highlighting should perform it at the appropriate + * moments based on Scintilla and Geany events such as when the document + * becomes visible or when the document is modified. + * + * @since 2.1 + **/ + gboolean (*symbol_highlight_provided)(GeanyDocument *doc, gpointer data);
IMO this is a recipe for getting it wrong. Why doesn't Geany define "appropriate moments based on Scintilla and Geany events" and calls a symbol_highlight_perform() then?
@kugel- I did it this way originally but there were situations where it didn't work. Consider for instance LSP server start - once it is started, it should colorize the current document. But for Geany "nothing happened" in the meantime - there was no Geany event that would trigger the colorization as Geany knows nothing about LSP processes and their start. So in this case you wouldn't get any colorization and documents would only get colorized once you trigger some Geany event like when you e.g. type something or switch tabs.
There will be a similar problem with the symbol tree update in https://github.com/geany/geany/pull/3910 where I think it would be best to have some `symbol_tree_reload()` function the plugin could call to force Geany reload the symbol tree as Geany doesn't know about all the situations in which it may be necessary.
To be precise, all of the other calls from this API suffer from the same problem - it's just that this isn't critical for something like autocompletion, calltips, or symbol goto which are originally processed by Geany before the server is started and only then switch to the server implementation.