ignatov / intellij-erlang

Erlang IDE

Home Page:https://www.jetbrains.com/help/idea/2018.2/getting-started-with-erlang.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auto formatting and space character

Vorticity-Flux opened this issue · comments

Integer code of a space character is represented as "$\ " (dollar backslash space). Unfortunately intellij-erlang code formatter does not take it into account and removes the space following backslash.
Due to this fact some code can be broken by autoformatting. For example: <<A/binary, $\ , B/binary>> will be formatted as <<A/binary, $\, B/binary>> and will fail compilation. In this case workaround is simple - use "" instead of $\<space>.
However in the following case the same workaround does not work:
[$1, $2, $\ , $\4] formats to [$1, $2, $\, $\4].

Ew, that's nasty =) I hope people don't use such escapes in their code.

It's even allowed to write code like this:

newline() -> $\
.

I'm not surprised github's highlighting doesn't work properly here =)

So the buggy part wasn't the formatter, but our lexer.

Thanks, @Vorticity-Flux!