rebar3_format icon indicating copy to clipboard operation
rebar3_format copied to clipboard

Support for sys.config.src

Open afhole opened this issue 3 years ago • 6 comments

Is there any support for the config.src format? When I run the formatter against sys.config.src it puts it the whole config onto a single line - is this format not supported, or do I need to tweak my config?

afhole avatar Apr 28 '21 12:04 afhole

🤔 Can you show me a sample config.src file? I was not aware of that kind of file existence at all.

elbrujohalcon avatar Apr 28 '21 12:04 elbrujohalcon

I believe it is a Rebar3/Relx feature:

Starting with Erlang/OTP 21 and rebar3 3.6.0 the configuration options sys_config_src and vm_args_src are available for explicitly including templates that will be rendered at runtime, substituting variables defined as ${VARIABLE} with their equivalent value in the shell environment.

http://rebar3.org/docs/deployment/releases/#environment-variable-replacement

afhole avatar Apr 28 '21 13:04 afhole

I'm not sure how easy it would be to support, before substitution the files are not valid terms

afhole avatar Apr 28 '21 13:04 afhole

Yeah… Not easy at all.

elbrujohalcon avatar Apr 28 '21 13:04 elbrujohalcon

Yeah maybe this is beyond the scope of a formatter, it's impossible to know even what the variables will expand to anyway

afhole avatar Apr 28 '21 13:04 afhole

It's not beyond the scope of the formatter (it can format those files without expanding them) but it's beyond the current capabilities of OTP's erl_syntax and therefore handling it will require some serious adjustments to ktn_dodger.

elbrujohalcon avatar Apr 28 '21 13:04 elbrujohalcon