Emacs-Kotlin-Mode-Maintainers/kotlin-mode

Indentation error on kotlin-mode

marcos-cezar opened this issue · 4 comments

When I'm typing an if, while or anything that opens a block of commands inside the main function. When i hit enter after the "if (exp) {" the close "}" is inserted and not indented. It can be seen on the image below.

kotlin-mode-indentation-error

I'm using Emacs 25.1.50.1 and this packages:

cask
color-theme-sanityinc-tomorrow
expand-region
ace-jump-mode
flx
flx-ido
yasnippet
projectile
helm-projectile
ido-ubiquitous
ido-vertical-mode
multiple-cursors
smartparens
magit
css-eldoc
ido-at-point
guide-key
simple-httpd
restclient
whitespace-cleanup-mode
elisp-slime-nav
exec-path-from-shell
ag
emmet-mode
js2-mode
js2-refactor
tern
smex
markdown-mode
browse-kill-ring
shell-command
dired+
vlf
scala-mode
sbt-mode
quickrun
dash-at-point
web-mode
undo-tree
ggtags
helm-gtags
ensime
company
company-quickhelp
avy
smart-mode-line
beacon
aggressive-indent
gradle-mode
wgrep
pt
icicles
o-blog
cider
clojure-mode
powerline
spaceline
peep-dired
use-package
groovy-mode
smart-comment
ace-window
zoom-frm
hydra
which-key
kotlin-mode

Typing your code fragment into Emacs 25.1.1 on Debian Sid, I find that the alignment is adjusted on pressing newline after the }.

This is an issue I've been aware of for a while. It's definitely a bug. I haven't seen any other major mode behave like this (scala-mode is what I spend most of my time in, for example).

This should be solved with #14

Running Emacs 25.2.1 with the Spacemacs distribution, the bracing indentation appears to work correctly now.

2017-08-05-145913_1904x1046_scrot

This was a test run with kotlin-tab-width set to 4.