renoise / definitions

LuaCATS definitions for the Renoise Lua API
4 stars 4 forks source link

Fix viewbuilder notifiers #16

Closed emuell closed 4 months ago

emuell commented 4 months ago

@unlessgames does this look sane to you?

The {notifier, context} overloads bloat things a bit, but that's how they are implemented everywhere...

unlessgames commented 4 months ago

Looks fine apart from the typo of the method being called notifer_method.

On a related note, I think write-only fields like pressed should be marked private (or protected) as they are not even write-only in the sense that you can't even write to them (only in the construction table which should be its own class anyway).

So for example after creating a button, you can't do

b = vb:button { text = "x" }
b.pressed = function() end

but the language server will happily auto-complete a function for b.pressed right now, which will crash at runtime later.

If they were notated as

---@field private pressed ...

the editor wouldn't offer the completion and it would warn you with "pressed is private and can't be accessed..." if you were trying to assign a function to it.

emuell commented 4 months ago

Looks fine apart from the typo of the method being called notifer_method.

Just have fixed that, renamed it to 'notifier'. Is this what you meant?

On a related note, I think write-only fields like pressed should be marked private (or protected)

See https://github.com/renoise/definitions/issues/17 please

unlessgames commented 4 months ago

I meant typo for the missing i, it's notifer now instead of notifier.

emuell commented 4 months ago

I meant typo for the missing i, it's notifer now instead of notifier.

Haven't even seen that. Thanks. This is now fixed :)