erlide_eclipse
erlide_eclipse copied to clipboard
Indentation [Ctrl-I] does not work after macro from mockgyver framework
We use the following mocking framework in our eunit tests: https://github.com/klajo/mockgyver
Whenever any of the mockgyver macros are used, after that line the erlang indentation does not work any more.
For example when the "?WHEN(...)" macro is commented out, CTRL-I works as expected:
But if I uncomment the "?WHEN(...)" line and highlight the same area and run CTRL-I, all lines after ?WHEN loses its indentation.
I guess something with the macro syntax makes erlide loose indentation???
That's correct. The macro is not well-formed (the argument is not a valid expression) and we don't really know what to do about it.
Currently, the indenter gives up in a bad way, losing indentation in the rest of the file. It should at least keep it as it was.
I am increasing the priority, but unfortunately I can't look at it right away.
The syntax "?WHEN(m:f() -> ok.)" compiles and runs without any problem, so I assume the macro is well-formed. Or does "well-formed" means something specific in this case?
Well-formed means "that can be parsed by erl_parse". In other words, if ?WHEN was a function name, would it compile?
In this case, the answer is 'no', because "m:f() -> ok" is not a valid Erlang expression.