Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why in the official Kotlin coding conventions we should omit root package in directory structure?

In the official Kotlin coding conventions (https://kotlinlang.org/docs/reference/coding-conventions.html) they recommend to us to omit root package in directory structure. It is not comfortable, when you create a new file in your kotlin source folder and then edit the package name, because it did not generated automatically.

like image 814
Alexey Nikitin Avatar asked Nov 02 '25 04:11

Alexey Nikitin


2 Answers

From a Reddit comment:

I guess you're supposed to use the package prefix enter image description here in the project structure, but sadly that feature is only available in IDEA and not Android Studio.

I agree it's weird that it's not documented more explicitly, I've only found https://www.jetbrains.com/help/idea/creating-and-managing-modules.html. You may want to consider raising the issue on http://discuss.kotlinlang.org/.

like image 163
Alexey Romanov Avatar answered Nov 04 '25 03:11

Alexey Romanov


Looks like support for packagePrefix was added to idea-ext gradle plugin in version 0.5 : https://github.com/JetBrains/gradle-idea-ext-plugin/wiki/DSL-spec-v.-0.5#package-prefix-requires-idea-20191

like image 34
alshan Avatar answered Nov 04 '25 03:11

alshan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!