I find myself creating documentation on the types themselves rather than defining them on the actual implementation. This keeps types organized from code, and is much easier to read at a glance (since types are packed tightly together) than the actual implementation (spans hundreds of lines! Hard to scroll through).
Unfortunately… there is no support for documentation tooltips when function comments are defined within types:
This would be especially useful because having a table be casted as a type breaks the ability to apply any doc comments to its functions whatsoever. For example:
type Library = {
DoSomething: () -> ()
}
local Library = {} :: Library
--[[
NEVER CALL THIS FUNCTION!!!
]]
function Library.DoSomething()
print("Commencing destruction sequence...")
DestroyTheUniverse()
end
return Library
Now whenever I look at the code completion, I only see this:
Well, to ask a question. Assuming I defined a tooltip comment in the type definition and then we further defined one in the concrete function implementation, would the concrete function implementation override the type definition tooltip?
Also I do agree this is a good addition. We could have something similar to interfaces/virtuals in other languages, without the actual function definition of course
I have tendency of making a module specifically for types, which appear in two or more scripts/modules, so having ability to put comments from one location would be huge plus.