pkulchenko / ZeroBraneStudio

Lightweight Lua-based IDE for Lua with code completion, syntax highlighting, live coding, remote debugger, and code analyzer; supports Lua 5.1, 5.2, 5.3, 5.4, LuaJIT and other Lua interpreters on Windows, macOS, and Linux
http://studio.zerobrane.com/
Other
2.61k stars 519 forks source link

Enhance static analyzer #821

Open LeRatierBretonnien opened 6 years ago

LeRatierBretonnien commented 6 years ago

Hi,

It should be great to be able to configure the static analyzer, in order to declare external modules/functions that are automatically loaded by the interpreter. For example, we embedd Lua in an application, which is pre-loading automatically many objects/modules. Hence, when we run the static analyzer on a script using those "internal" modules, the infervalue mode is producing a lot of warnings, which are wrong in our context of use. So having an option to pre-declare the modules/functions as an input of the static analyzer would be great.

Also it appears that the "infervalue" mode does not take into account modules loaded with the "require" keyword. This feature would be very great, also.

madmaxoft commented 6 years ago

I think this is more or less a duplicate of #788 - if you have an API definition for your environment, 788 asks for the analyzer to read it.

LeRatierBretonnien commented 6 years ago

Yes, correct, sorry i missed this one. This is somehow similar, yes.

jjvbsag commented 6 years ago

I think this is more or less a duplicate of #788

For internal modules you are right, these issue have the same direction. I have added a concrete example in #788. @sladecraven please have a look, if your requirement would be the same or if there are any differences

Also it appears that the "infervalue" mode does not take into account modules loaded with the "require" keyword. This feature would be very great, also.

Yes. We don't pre-load modules, but always "require" them, so your pre-load is an addition to #788

LeRatierBretonnien commented 6 years ago

Yes, pre-load modules is an addition of #788