Types Missing and BackdropTemplate Type Warnings
I believe one of the recent updates removed the backdropInfo and backdropInsets types.
Since updating to 0.19.1, I've been getting param-type-mismatch type warnings when creating frames using the "BackdropTemplate" argument. If I revert to 0.18.2, these go away.
local button = CreateFrame("Button", Type .. "Button" .. count, frame, "BackdropTemplate") button:SetBackdrop(buttonBackdrop)
Cannot assign table|BackdropTemplate|Button to parameter BackdropTemplateMixin.
However, if I hover over the function definition for SetBackdrop, it correctly shows the preview:
(method) BackdropTemplateMixin:SetBackdrop(backdropInfo: any)
Same thing happens if I explicitly type it:
---@type table|Button|BackdropTemplateMixin
I still don't know why but it's fixed by adding local infront of the mixin. I indeed used this "hack" until I switched in v0.19.0 to the generated FrameXML annotations by @Numynum
- BackdropTemplateMixin = { }
+ local BackdropTemplateMixin = { }
- 0.18.2 https://github.com/Ketho/vscode-wow-api/blob/0.18.2/Annotations/Widget/UIType/Template/Backdrop.lua#L19
- 0.19.0 https://github.com/NumyAddon/FramexmlAnnotations/blob/efe381e8b372abd66c89697df97c2ca042c737be/Annotations/AddOns/Blizzard_SharedXML/Backdrop.lua.annotated.lua#L5
Since the annotations are in a submodule now I'd have to bother Numy to fix it. (But I might have to fallback to manually annotating or generating the FrameXML annotations myself)
I can certainly take a look
Oh, that is strange! I've never fully understood how meta files are parsed, especially templates. Just kinda did stuff until it worked..
I despise dynamically typed languages and I explicitly type everything in Lua, so I really appreciate the work put in to this project.
Besides the backdrop types it's also missing param arguments and returns yes, as that's a bit more difficult to generate from the mixins instead of manually
~~I played around a little, and I'll adjust the annotation generator~~ edit, actually I found something that might be problematic, looking a bit more
I'd recommend putting the manual annotation back in though, at least for functions that have extra information (such as param/return types)
I don't really like the workaround of putting local in front of the mixin definition, since it causes other QoL issues (when you add framexml as a luals workspace library)
a different workaround you can consider is to use "type.weakUnionCheck": true; which I think is likely generally the desired behaviour in the context of wow addons anyway
I've enabled the type.weakUnionCheck option which prevents the diagnostic warning.
But I will make the load FrameXML option disabled by default since it takes around 14 seconds to load them all. I can't really seem to find a good middle ground to supporting templates easily and not just loading the whole framexml folder.
~~Instead of submoduling I'm thinking of manually copying Numy's repo, and then moving some files to a different folder and making some manual changes for stuff like BackdropTemplate, ItemLocation, etc.~~