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

Poor formatting rules #1408

Closed
illotum opened this issue Nov 18, 2022 · 2 comments
Closed

Poor formatting rules #1408

illotum opened this issue Nov 18, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@illotum
Copy link

illotum commented Nov 18, 2022

Embedded erlfmt doesn't respect code conventions and generally isn't consistent with standalone erlfmt

To Reproduce

Input snippet:

-module(some).

f2(A, B) -> {
     ok,
     yes}.

f(#{a := A, b := B, c := C}, Other) ->
        case f2(A, B) of
            undefined -> no;
            error -> no;
            {ok, _} -> yes
        end.

Expected behavior

Formatting applied with escriptized WhatsApp/erlfmt, erlfmt -w some.erl:

-module(some).

f2(A, B) ->
    {                                     %% respects standalone brace
        ok,
        yes
    }.

f(#{a := A, b := B, c := C}, Other) ->    %% wider line len
    case f2(A, B) of
        undefined -> no;                  %% respects inline cases
        error -> no;
        {ok, _} -> yes
    end.

Actual behavior

Formatting applied (via NVIM's vim.lsp.buf.format callback):

-module(some).

f2(A, B) ->
    {ok, yes}.

f(#{a := A,
    b := B,
    c := C},
  Other) ->
    case f2(A, B) of
        undefined ->
            no;
        error ->
            no;
        {ok, _} ->
            yes
    end.

Context

@illotum illotum added the bug Something isn't working label Nov 18, 2022
@plux
Copy link
Contributor

plux commented Sep 26, 2024

Can't reproduce.
Are you sure erlfmt was configured as formatter?

Closing this, please re-open if I'm wrong :)

@plux plux closed this as completed Sep 26, 2024
@illotum
Copy link
Author

illotum commented Oct 4, 2024

Are you reproducing it in v0.46? If it is fixed in v1, great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants