Malabarba/aggressive-indent-mode

Can't add trailing whitespace

Antisune opened this issue · 1 comments

The whitespace at the end of the current line is removed as I type it.
ie.
def sum(ints: List[Int]): Int = {

becomes

defsum(ints:List[Int]):Int={
Because every space character is deleted right after it is entered.

I already turned off electric-mode
NOTE: this is only the case for my scala buffer, it is working as expected on my init.el

This is an unfortunate consequence of the fact that scala-mode removes whitespace at the end of the line when you try to indent. For instance, if you type def and then hit TAB, the space will be deleted and the cursor will move back a spot.

You can workaround this by doing this:

(add-to-list 'aggressive-indent-dont-indent-if 
             '(and (eq (char-before) ?\s) (looking-at-p "$")))

But I recommend reporting it as a bug on Scala-mode as well