IntelliJ-Luanalysis icon indicating copy to clipboard operation
IntelliJ-Luanalysis copied to clipboard

Unable to extend `Std__` libraries

Open pouwelsjochem opened this issue 3 years ago • 1 comments

Environment

name version
IDEA version LATEST
Luanalysis version [1.2.2
OS MacOS

What are the steps to reproduce this issue?

math.additionalFunction = function()

end

What happens?

An error saying "No such member 'additionalFunction' found on type 'std__Math' " and seemingly no way to extend the math class with annotations.

math = math ---@class myMath : std__Math`

doesn't work

---@class myMath : std__Math

math = math ---@type myMath

also doesn't work

What were you expecting to happen?

The ability to extend the math class or any other standard library in some way. math is now always seen as std__Math (by type infer and error inspection) and as far as I can see there's no way to change this

pouwelsjochem avatar Mar 02 '21 12:03 pouwelsjochem

This is a big issue for me as well, as I was using EmmyLua before and thought about migrating to Luanalysis as it offers a few nicer things. However my code base heavily extends 'table' which now isn't recognized by Luanalysis and thus has errors all over the place. Can anyone tell me where in the code this change from EmmyLua is made, then I could change that myself?

timm-gatg avatar Aug 04 '21 09:08 timm-gatg