FPtje / GLuaFixer

Linter for Garry's mod Lua.
https://fptje.github.io/glualint-web/
GNU Lesser General Public License v2.1
142 stars 19 forks source link

Glualint pretty print breaking on certain code #144

Closed wrefgtzweve closed 1 year ago

wrefgtzweve commented 1 year ago
func(function()end)

Linting works fine but when trying to format this piece of code it will return <<loop>> and not actually format the code.

Can be replicated in https://fptje.github.io/glualint-web/ image

Gluafixer executable image

GrayWolf64 commented 1 year ago

I also encountered similiar problems, it just errors at a a specific file (with no syntax errors, about 200 lines), and when I use cmd to run glualint test <myfile>, <<loop>> is displayed. I am on VSCode Insider. I also put it into glualint-web but clicking on the button gives me no response (<<loop>> can be seen in browser console).

GrayWolf64 commented 1 year ago

For example,

    PanelTimedFunc(Icon, UpdateInterval, function() end, function()
        Icon:SetImage("icon16/disconnect.png")
        SendEmptyMsgToSV("ChkConnectedcl")

        net.Receive("ChkConnectedsv", function()
            if not net.ReadBool() then
                return
            end
            Icon:SetImage("icon16/connect.png")
        end)
    end)

will cause the problem. It seems that it will error because of functions inside of other functions.

FPtje commented 1 year ago

That looks like a bug in the pretty print code. Thanks for providing a minimal example. I should be able to debug the code with that.

FPtje commented 1 year ago

Fixed in https://github.com/FPtje/GLuaFixer/releases/tag/1.24.1!

FPtje commented 1 year ago

All platforms have now been released, and glualint-web has also been updated with the latest version.

In other news, glualint-web has not been updated in a long while, and for some reason I had to compile the ghcjs compiler and dependencies myself. That took a while :sweat_smile: