Groovy-Emacs-Modes / groovy-emacs-modes

A groovy major mode, grails minor mode, and a groovy inferior mode.
84 stars 39 forks source link

Incorrect indentation for statements without {} #101

Closed bahmanm closed 6 years ago

bahmanm commented 7 years ago

Imagine the following code block, correctly indented assuming the indentation size is 2:

  if (x > 10)
    x * 2
  else
    x

  // OR

  while (x > 10)
    x += 1

In Emacs they are indented as below:

  if (x > 10)
  x * 2 // note the missing indent
  else
  x // ditto

  // OR

  while (x > 10)
  x += 1 // ditto

I'm not sure if it's an issue with the mode or with my configuration. What am I missing?

Wilfred commented 7 years ago

That's definitely a bug with the mode. It's largely counting { at the moment, so it doesn't yet handle this case.