justarandomgeek / vscode-factoriomod-debug

Factorio Mod Tool Kit
Other
97 stars 21 forks source link

LuaGuiElement.elem_value can be nil #107

Closed Inrixia closed 5 months ago

Inrixia commented 6 months ago

The property elem_value on a LuaGuiElement can be nil if there is no selected item. To clear the selected item nil must be assigned to this property.

image

Currently it can only be set to string|SignalID as seen above. I'm bypassing the type checks atm to reset it, but figured id note it here. Afik this may be a issue with the auto generated types from the Factorio docs and not this in which case there probably isnt anything you can do, but maybe someone knows who to pass this along to.

--- @diagnostic disable-next-line: assign-type-mismatch
filterButton.elem_value = currentFilter
Bilka2 commented 6 months ago

Afik this may be a issue with the auto generated types from the Factorio docs and not this in which case there probably isnt anything you can do, but maybe someone knows who to pass this along to.

The right place to report an issue like that would be https://forums.factorio.com/viewforum.php?f=233, which is linked at the bottom of the docs website.

However, the property is marked as optional in the docs. So the type generation by the extension is the issue in this case. Looks like attributes that are marked as optional don't get that information transferred to the generated LuaLS types. Issue is not present with extension version 1.1.37, is present with 1.1.39.

justarandomgeek commented 6 months ago

That's what i get for doing a big rewrite to make use of the new stuff! This will be fixed for the next version. Seems i missed a few kinds of optionals along the way, hopefully this is the last one...

justarandomgeek commented 5 months ago

1.1.40 should fix this