Navigation between gradle kts files and toml files...
# intellij
m
Navigation between gradle kts files and toml files are broken if I use scope function like below
Copy code
libs.apply {
        android.apply {
            implementation(composeActivity)
            implementation(composeNavigation)
            implementation(constraintLayout)
            implementation(navigation)
            implementation(koinAndroid)
            implementation(koinCompose)
            implementation(lifecycleRuntime)
            implementation(splashScreen)
        }
}
but works if I use
Copy code
implementation(libs.android.composeActivity)
            implementation(libs.android.composeNavigation)
            implementation(libs.android.constraintLayout)
            implementation(libs.android.navigation)
            implementation(libs.android.koinAndroid)
            implementation(libs.android.koinCompose)
            implementation(libs.android.lifecycleRuntime)
            implementation(libs.android.splashScreen)
is there any way to fix this issue ? It is quite helpful in KMP projects. Also dependencies seems as not used when I use scope functions
k
In your second code snippet,
Copy code
dependencies {
            implementation(libs.android.composeActivity)
}
calls
DependencyHandler.implementation(...)
and does the right thing. But in your first code snippet, considering what
apply
actually does:
Copy code
libs.apply {
        android.apply {
            implementation(composeActivity)
        }
}
is equivalent to calling
libs.android.implementation(composeActivity)
which is not the same thing.
m
in the second one it also calls the
Copy code
implementation(libs.android.composeActivity)
since we have the scope from
libs
and
android
, also
libs.android.implementation(composeActivity)
would give a compiler time error which doesn’t happen
k
You're right