How to change tab size for Kotlin project?

I created a simple Kotlin project following your tutorial. I want to change tab size from 4 to 2. I went to Editor > Code Style > Java and set tab size 2 for Scheme: Project. I did the same for Other File Types, but when I edit my code the tab size is still 4. What else do I have to do?

6 comments
Comment actions Permalink

Err, change the tab setting in the "Kotlin" panel?

0
Comment actions Permalink

Where is Kotlin panel? Google search finds only one match and it is your response.

0
Comment actions Permalink

Don't you have
Editor > Code Style >Kotlin ?



Attachment(s):
kotlin.png
0
Comment actions Permalink

Yes, I do. I'm almost certain it wasn't there 2 days ago, but maybe it was just too late at night. Unfortunately, setting tab length in Editor > Code Style >Kotlin doesn't affect *.kt file. Tab settings in Editor > Code Style >Java work for *.java files, though.

Here is a screenshot showing tab=2 in preview and unchanged tab=4 in the editor:

IntelliJ.png

0
Comment actions Permalink

That preview shows that you did not check the "Use tab character" checkbox.

Is indentation still wrong if you select that option and reformat your file?

0
Comment actions Permalink

OK, it works. "Reformat Code" was the missing piece. I'm used to other IDEs, which don't require reformat operation. Thank you for your help.

0

Please sign in to leave a comment.