Groovy-Emacs-Modes / groovy-emacs-modes

A groovy major mode, grails minor mode, and a groovy inferior mode.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect indentation occurs when slash-star comments contain keyword 'if' or 'for'

FormerPhysicist opened this issue · comments

commented

When the slash-star comment style is used and the comment contains a keyword like "if" or "for", then the next line is incorrectly indented. For example,

/* Comment contains if */
	def foo = true

/* Comment contains for */
	def bar = true

/* Clean comment, no problem */
def x = false

// This is fine either way -> if for
def y = false

This appears in groovy mode version 2.1 and in emacs version 26.1

Looking at your code in groovy-mode.el, it looks like that the function groovy--prev-code-line is incorrectly returning the comment lines between /* */ as normal code to the function groovy-indent-line which is adding an additional indent level for the if or for blocks it "sees" in the comment.

I'll submit a merge request with what I think will fix the issue.

Fixed? :)