pgourlain / vscode_erlang

Erlang support for Visual Studio Code
MIT License
130 stars 46 forks source link

Add more settings to the code formatter #102

Closed codeadict closed 6 years ago

codeadict commented 6 years ago

First, thanks y'all for this great project. The actual code formatter causes some weird indentation like:

change_config(Configs) ->
    case lists:keyfind(?APP, 1,
               application:which_applications())
    of
      false ->
      ok;
      _ ->
      lager:debug("Reloading config ~p", [Configs])
    end.

I suspect this happens because it needs a setting for longer line lengths.

Is there any workaround for this or is indeed a limitation of this plugin?

pgourlain commented 6 years ago

Hi,

thanks for your report.

Right now, erl_tidy: format (file) is used to format document. there is no workaround as is. I should use http://erlang.org/doc/man/erl_prettypr.html#format-2 in next release to get more options for breaking line length limit

codeadict commented 6 years ago

Or having the option to format with emacs maybe?

On Mon, Aug 13, 2018, 04:46 Pierrick Gourlain notifications@github.com wrote:

Hi,

thanks for your report.

Right now, erl_tidy: format (file) is used to format document. there is no workaround as is. I should use http://erlang.org/doc/man/erl_prettypr.html#format-2 in next release to get more options for breaking line length limit

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pgourlain/vscode_erlang/issues/102#issuecomment-412449619, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKR-Do3FfMTGaoKF5oPQuj7dSUBQgOxks5uQT0BgaJpZM4V5Kl9 .

pselden commented 6 years ago

There's a code formatter? How do I use it?

Attempting to format the file leads to "There is no selection formatter for 'erlang'-files installed."

pgourlain commented 6 years ago

Hello

@pselden , yes there is a code formatter, but today only for whole file( remove selection before formating)

fholzhauser commented 5 years ago

Hi, Could you please reopen this one ? I think the original request was for whole file formatting and is very relevant. Unfortunately the comment about selection formatting "hijacked" this useful feature request. Would it be possible to add the line lenght (paper/ribbon) configurable options to erl_prettypr:format ? And indeed thanks for your work on this great plugin !