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

anonTypeCurly has no affect on anonymous functions #560

Closed
IljaK opened this issue Feb 26, 2020 · 7 comments
Closed

anonTypeCurly has no affect on anonymous functions #560

IljaK opened this issue Feb 26, 2020 · 7 comments
Labels
duplicate This issue or pull request already exists

Comments

@IljaK
Copy link

IljaK commented Feb 26, 2020

Anonymous funtions are being formatted as common "blockCurly"

Input file

{
    "lineEnds": {
        "blockCurly": {
            "leftCurly": "both",
            "rightCurly": "both",
            "emptyCurly": "break"
        },
        "anonTypeCurly": {
            "leftCurly": "none",
            "rightCurly": "before",
            "emptyCurly": "noBreak"
        }
    },
    "whitespace": {
        "bracesConfig": {
            "anonTypeBraces": {
                "openingPolicy": "none",
                "closingPolicy": "none"
            }
        }
    }
}

Broken output

private function someFunc()
{
    timer.onComplete(() ->
        {
            delayedCombine(assetConfigVo, firstCombinedSymbol, symbolsToBeCombinedWithFirstList);
        });
}

Expected output

private function someFunc()
{
    timer.onComplete(() -> {
        delayedCombine(assetConfigVo, firstCombinedSymbol, symbolsToBeCombinedWithFirstList);
    });
}

Am I missing something? There is not much documentation about options, but seems like any "anon" option has no affect.

@Gama11
Copy link
Member

Gama11 commented Feb 26, 2020

Well, that is indeed a block, and not an anonymous type. :)

@IljaK
Copy link
Author

IljaK commented Feb 26, 2020

So which properties I need to use to have expected output or it is not possible?

@AlexHaxe AlexHaxe added the duplicate This issue or pull request already exists label Feb 26, 2020
@AlexHaxe
Copy link
Member

duplicate of #538

you basically want:

{
    "lineEnds": {
        "blockCurly": {
            "leftCurly": "both",
            "rightCurly": "both",
            "emptyCurly": "break"
        },
        "anonFunctionCurly": {
            "leftCurly": "after",
            "rightCurly": "before"
        }
    },
    "whitespace": {
        "bracesConfig": {
            "anonTypeBraces": {
                "openingPolicy": "none",
                "closingPolicy": "none"
            }
        }
    }
}

@Gama11
Copy link
Member

Gama11 commented Feb 26, 2020

Ah, I guess that change hasn't been released yet.

@AlexHaxe
Copy link
Member

oh... I guess I need to release it eventually....

@IljaK
Copy link
Author

IljaK commented Feb 26, 2020

What about whitespace for anonymous function braces?

@AlexHaxe
Copy link
Member

AlexHaxe commented Feb 26, 2020

there is currently no option to have different whitespace settings for anonymous functions

[edit]only arrowFunctionsPolicy[/edit]

AlexHaxe added a commit to AlexHaxe/haxe-formatter that referenced this issue Mar 23, 2020
AlexHaxe added a commit that referenced this issue Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants