Missing some async/finish functions
vixalien opened this issue · 6 comments
Hello.
When using types generated by ts-for-gir 4.x, I found that some functions are not being detected as async/finish functions.
Functions with a signature resembling function_name_async
and then function_name_finish
seem to be generated correctly, but functions with a signature resembling function_name
and then function_name_finish
don't seem to be generated correctly.
Some examples include:
Gtk.FileDialog.open_multiple
Gtk.ColorDialog.choose_rgba
Xdp.Camera.access_portal
Xdp.Portal.pick_color
Gtk.FileDialog.open
Xdp.Portal.session_monitor_start
- most other
Xdp.Portal.*
functions
A possible way to detect these would be to check if a function's last parameter is a Gio.AsyncReadyCallback
, and then detecting if there's a similar function with _finish
suffix AND which takes in a Gio.AsyncResult
as only parameter.
Another idea would be to add annotations upstream so other bindings can benefit and do not need to add heuristics, too.
Yeah. We would likely need to create an initiative to add these annotations. Would be better as a coordinated effort imo.
My philosophy is to do it on a case by case basis. I started adding some ref-func
annotations upstream because my project would benefit from it.
If some async function annotations are missing the specifically requested ones would be added by myself. Fixing all the annotations in a big effort would probably add a lot of burden to the maintainers of the upstream libraries and on the own binding project, too.
I just wanted to mention the annotations as from my point of view they are technically the better solution to the problem of missing async functions.
At least for my C# bindings I decided to not add more heuristics but to fix upstream instead.
@vixalien do you mean the promisified version of the types? Then that should be fixed with the last release 🎉
Yeah that's what I was talking about. I'll check the latest types. Thanks!!!