erlang / erlide_eclipse

Eclipse IDE for Erlang
http://erlide.org
202 stars 70 forks source link

Indentation [Ctrl-I] does not work after macro from mockgyver framework #170

Open drapostolos opened 10 years ago

drapostolos commented 10 years ago

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: image

But if I uncomment the "?WHEN(...)" line and highlight the same area and run CTRL-I, all lines after ?WHEN loses its indentation.

image

I guess something with the macro syntax makes erlide loose indentation???

vladdu commented 10 years ago

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.

drapostolos commented 10 years ago

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?

vladdu commented 10 years ago

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.