Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If Then Else in various langauges gets indented wrong #1

Open
BloodyRain2k opened this issue Feb 2, 2015 · 2 comments
Open

If Then Else in various langauges gets indented wrong #1

BloodyRain2k opened this issue Feb 2, 2015 · 2 comments

Comments

@BloodyRain2k
Copy link

When using the plugin for lua it works nicely except for If Then Else blocks where

function onNodeConnectionChange(args)
    if entity.isInboundNodeConnected(0) then
        storage.inputOpen = entity.getInboundNodeLevel(0)
    else
        storage.inputOpen = true
    end
end

gets turned into

function onNodeConnectionChange(args)
    if entity.isInboundNodeConnected(0) then
        storage.inputOpen = entity.getInboundNodeLevel(0)
        else
        storage.inputOpen = true
    end
end
@ffes
Copy link
Owner

ffes commented Feb 18, 2015

I don't think there is much that can be done about it. When you look at the [+] or [-] in the left margin you can see want the parsers thinks are foldable lines. And you see no [+] or [-] is shown at the "else" line. So the lua parser needs to be more advance

@ffes
Copy link
Owner

ffes commented May 12, 2020

This issue is not specific to Lua and the some issues were opened for other languages. So I recently added a FAQ: https://indentbyfold.readthedocs.io/en/latest/faq.html#faq-if-else

I will change the title of this issue and close the others as a dup of this one

@ffes ffes changed the title If Then Else in Lua gets indented wrong If Then Else in various langauges gets indented wrong May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants