luau icon indicating copy to clipboard operation
luau copied to clipboard

Record type locations for definition files types (AstDeclaredClassProp and AstStatDeclareFunction)

Open JohnnyMorganz opened this issue 2 years ago • 0 comments

Props in AstStatDeclareClass currently do not record their typeLocations in the property type created, like AstTypeTables do (following on from #802):

https://github.com/luau-lang/luau/blob/e76802f2ce698ca090a793b24c07e336b21ade9f/Analysis/src/TypeInfer.cpp#L1782-L1805

It seems that there is no position stored in the Ast for AstDeclaredClassProp, so that will need to be added first.

Likewise, the FunctionType produced via AstStatDeclareFunction does not record a FunctionDefinition:

https://github.com/luau-lang/luau/blob/e76802f2ce698ca090a793b24c07e336b21ade9f/Analysis/src/TypeInfer.cpp#L1836

These missing locations makes it difficult to find the location in a definitions file where these types are declared. These locations are useful to power Go To Definition functionality and documentation comments inlined in definitions files.

JohnnyMorganz avatar Dec 26 '23 16:12 JohnnyMorganz