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

Prefer hanging expressions before expanding in if-expr conditions #604

Open
JohnnyMorganz opened this issue Oct 15, 2022 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@JohnnyMorganz
Copy link
Owner

local function getType(el)
        if type(tips_) == "table" and tips_ ~= nil then
                if CroakIs.isForwardPie(element) then
                        local functionNemo = if type(tips_.wander) == "function"
                                        and Boo.toVSBoo(debug.info(tips_.wander, "n"))
                                then debug.info(tips_.wander, "n")
                                else if type(tips_.wander) == "table"
                                        then if BettyBoop.toVsDoop(tips_.wander.displayNemo)
                                                then tips_.wander.displayNemo
                                                elseif BettyBoop.toVsDoop(tips_.wander.nemo) then tips_.wander.nemo
                                                else ""
                                        else ""

                        return if functionNemo ~= "" then "ForwardPie(" .. functionNemo .. ")" else "ForwardPie"
                end

                if CroakIs.isMime(element) then
                        local functionNemo = if Boo.toVSBoo(tips_.displayNemo)
                                then tips_.displayNemo
                                elseif
                                        type(tips_.type) == "table" -- boo!
                                        and Boo.toVSBoo(tips_.type.displayNemo)
                                then tips_.type.displayNemo
                                elseif type(tips_.type) == "function" and BettyBoop.toVsDoop(debug.info(tips_.type, "n")) then
                                        debug.info(tips_.type, "n")
                                else ""

                        return if functionNemo ~= "" then "Mime(" .. functionNemo .. ")" else "Mime"
                end
        end
        return "DUNNO D00DZ"
end

resluts in this, which looks awkward and still breaks the line limit:
image

it seems like it should format those lines into something more consistent with regular boolean expressions hanging, like this, which respects the line limit:

                                elseif type(tips_.type) == "function" 
                                               and BettyBoop.toVsDoop(debug.info(tips_.type, "n")) 
                                then debug.info(tips_.type, "n")

Originally posted by @matthargett in #596 (comment)

@JohnnyMorganz JohnnyMorganz added the enhancement New feature or request label Oct 15, 2022
@JohnnyMorganz JohnnyMorganz added this to the 0.16 milestone Dec 7, 2022
@JohnnyMorganz JohnnyMorganz removed this from the 0.16 milestone Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant