Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Make the indentation in comprehensions configurable #134

Closed
bjansen opened this issue Feb 21, 2017 · 7 comments
Closed

Make the indentation in comprehensions configurable #134

bjansen opened this issue Feb 21, 2017 · 7 comments

Comments

@bjansen
Copy link
Contributor

bjansen commented Feb 21, 2017

Some people prefer this:

void testDestructureComprehensions() {
    value v = {
        for ([a, b, c] in [[1, 2.0, '3']])
        for ([Integer x, Float y, Character z] in [[a, b, c]])
        for ([init, *others] in [[0, *(1..runtime.maxIntegerValue)]])
        for ([String first, String *rest] in [["executableName", *process.arguments]])
        for (m->n in [true->"true"])
        for (Boolean o -> String p in [m->n])
        if (exists [ai, bi, ci] = { [1, 2.0, '3'] }.cycled.rest.first)
        if (exists [Integer xi, Float yi, Character zi] = { [ai, bi, ci] }.cycled.rest.first)
        if (exists [initi, *othersi] = [0, *(1..runtime.maxIntegerValue)])
        if (exists [String firsti, String *resti] = ["executableName", *process.arguments])
        if (exists mi->ni = { true->"true" }.cycled.rest.first)
        if (exists Boolean oi -> String pi = { mi->ni }.cycled.rest.first)
        nothing
    };
}

over this:

void testDestructureComprehensions() {
    value v = {
        for ([a, b, c] in [[1, 2.0, '3']])
            for ([Integer x, Float y, Character z] in [[a, b, c]])
                for ([init, *others] in [[0, *(1..runtime.maxIntegerValue)]])
                    for ([String first, String *rest] in [["executableName", *process.arguments]])
                        for (m->n in [true->"true"])
                            for (Boolean o -> String p in [m->n])
                                if (exists [ai, bi, ci] = { [1, 2.0, '3'] }.cycled.rest.first)
                                    if (exists [Integer xi, Float yi, Character zi] = { [ai, bi, ci] }.cycled.rest.first)
                                        if (exists [initi, *othersi] = [0, *(1..runtime.maxIntegerValue)])
                                            if (exists [String firsti, String *resti] = ["executableName", *process.arguments])
                                                if (exists mi->ni = { true->"true" }.cycled.rest.first)
                                                    if (exists Boolean oi -> String pi = { mi->ni }.cycled.rest.first)
                                                        nothing
    };
}

It would be nice if the indentation was configurable.

@lucaswerkmeister
Copy link
Contributor

Should this be an Integer comprehensionIndentationLevels (default 1, @bjansen 0) or a Boolean indentComprehensions (default true, @bjansen false)? Integer is more general, but I assume almost nobody would use any values but 0 and 1, and a Boolean is friendlier to the IDE settings dialog (checkbox instead of number entry field).

@bjansen
Copy link
Contributor Author

bjansen commented Feb 21, 2017

I vote in favor of a Boolean, people are not crazy enough to want double indents for this ;)

@jvasileff
Copy link

Boolean | Integer indentationEnabledOrSpaces :)

I've seen 1-space indenting on gitter.

@bjansen
Copy link
Contributor Author

bjansen commented Feb 21, 2017

🙄

@jvasileff
Copy link

They should add that emoji to the standard list

@bjansen
Copy link
Contributor Author

bjansen commented Feb 21, 2017

I got it from macOS' emoji keyboard! http://emojipedia.org/face-with-rolling-eyes/

@lucaswerkmeister
Copy link
Contributor

I really don’t want to support indentation independent of indentMode… let’s keep it to levels, at least.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants