Kotlin code style: Space before left parenthesis

Answered

I like to have a space between the identifier and the left parenthesis in things like function and class declarations. There is an option for this in most of the code style settings (e.g. Java, Javascript) but it doesn't seem to exist for Kotlin. I just wanted to check I hadn't somehow missed it.

2
6 comments

This feature is already implemented and will be available in 1.1.4 version, see https://youtrack.jetbrains.com/issue/KT-16558 for details.

Please use https://discuss.kotlinlang.org/ for Kotlin specific question in the future.

0

Great, thanks for the quick response, happy to see it's coming soon. I wouldn't say this is a Kotlin specific question though since it's about the code style and auto-formatting feature of the IDE, independent of the language.

0

All Kotlin related questions, even if they are about IntelliJ IDEA should go to the Kotlin forum, YouTrack also has the separate KT project for the issues specific to Kotlin. Code style and formatting issue is in that project and there is a special subsystem: IDE.

0

Actually, looking at that bug report and the corresponding pull request, this doesn't seem to be quite what I was asking for. This seems to be an option for a space before if, while, when, and catch statements. What I was talking about was spaces before parentheses in function and class declarations. Java code style has the option for spaces before parentheses in 'method declaration parentheses' and 'method call parentheses' but Kotlin does not. I just wanted to make sure I hadn't missed something obvious but it looks like I haven't so I will go ahead and submit a feature request for this.

0

See the links to other formatter related requests at https://youtrack.jetbrains.com/issue/KT-2440.

You may get better answers in the Kotlin forum since it's read by Kotlin developers unlike this forum.

0

Yes, will do, thanks for your help.

0

Please sign in to leave a comment.