Hi,
When opening a file which has tasks, they won't show unless you click the refresh button, I'm not sure if it is default and why? (1.38 kubuntu 22.04, plasma 5.24)
Kind regards,
Confirmed with current git, tasks not shown on open, refresh or switching tabs needed to show them.
I debugged this and the plugin works. But for some reason, when the plugin checks the newly opened file for comments and to look for keywords, there is no styling set yet in the Scintilla object. And since there is no styling set, the plugin finds no comments at all (https://github.com/geany/geany-plugins/blob/master/addons/src/ao_tasks.c#L58...) and skips the line.
This has been working in the past. I wonder if there was a change in Scintilla so that configured styles are applied asynchronously (in a separate thread or so) and so the plugin searches for styles before they have been applied.
This particular case can be fixed by a `g_idle_add()` callback. But I wonder what else might be affected by this, there are probably more plugins and maybe also Geany directly affected if this is the actually the case.
I wonder if there was a change in Scintilla so that configured styles are applied asynchronously
No, Geany does that, `document_open_file_full()` calls `queue_colorise()` which calls `widget_queue_draw()` which will call the lexer when the mainloop is idle and the next frame is drawn. So it returns without having set styles, and then `document_open_file_full()` emits the `document-open` signal that calls `ao_tasks_update()` which won't find the tasks because the styles havn't been set yet.
AFAICT thats been the way its done forever (at least back to 2017 which was as far as I traced it). So in theory it never worked, maybe GTK has changed its scheduling of draws at some point and we didn't notice that this stopped working.
Looking at when `ao_tasks_update()` is called, maybe the process of creating and setting up a tab caused a page switch after the document is drawn and styles are setup. That would emit a `document-activate` signal which also calls `ao_tasks_update()`. IIRC there was some fiddling with this somewhere, but of course I can't find it now ;-P
Scintilla doesn't start using threaded layout until 5.2.x AFAICT, but Geany git is 5.1.5. Be prepared for chaos when [#3441](https://github.com/geany/geany/pull/3441) is merged :imp:
Thank you @elextr for the detailed analysis and for finding that it's us in Geany itself and not (yet) Scintilla.
Apart from the upcoming Scintilla change, #1257 should improve the current situation for the Addons task updating by delaying it. In my tests, this worked reliably.
Closed #1254 as completed via #1257.
github-comments@lists.geany.org