Does anyone know how to debug sources not appearin...
# intellij
r
Does anyone know how to debug sources not appearing in IntelliJ CE? Any time I ctrl+click through to the implementation of something, I get taken to "decompiled class file". Clicking "download sources" does nothing. Clicking "choose sources" pops a filesystem picker which also appears to do nothing.
w
Perhaps the
download sources during project import
option will help. It's new and I recall something about it being off by default
r
I found (and toggled) that, but it's made no difference, even after relaunching IntelliJ
Is there anything I need to do to force it to download?
w
import project
or
sync project with gradle files
action, depending how it's called (it's sync in Android Studio and I think
import
in IJ)
r
Thank you. I've re-synced with Gradle, no change. Still just get the decompiled class file :(
d
Does the library you’re importing have a published sources jar?
r
I'm seeing this with compose (desktop). I'd assume it has published sources, how can I check?
s
plus1 this happens to me all the time 😞 it seems to have got worse recently too. It's a huge pain since I rely on sources a lot.
2
k
Usually I just want documentation (ctrl+Q). If sources are downloaded, the documentation is taken from them. But I very often have the same problem. One thing I've tried recently (and seems to have improved things a little bit) is to add the
idea
Gradle plugin, and then use that in the build.gradle.kts to automatically download sources:
Copy code
plugins {
    val kotlinVersion = "1.9.22"
    kotlin("jvm") version kotlinVersion
    kotlin("plugin.serialization") version kotlinVersion
    application
    idea // <------ add this
}

idea {
    module {
        isDownloadJavadoc = true
        isDownloadSources = true
    }
}
Having said that, I don't like the idea of contaminating the Gradle build file with IDE-specific things.
r
Oh interesting, I'll try that.
Being able to jump into the sources is one of the things I've loved about working with compose in the past. I really wish that IntelliJ worked more reliably though--it's a real downer on the developer experience.
By comparison, I use GoLand for go development and it's solid as a rock. I never run into these sorts of issues. Documentation always works. Can always click through to the source. Never runs out of memory. Is the root cause of these issues with IntelliJ that JVM build systems are wildly overcomplicated?
Unfortunately, adding the idea plugin has not made a difference.
d
Can you share your gradle file? Kind of hard to offer suggestions without seeing the whole thing.
r
I'm using the default compose multiplatform project template
Basically just "hello world" land
d
I have never used compose.
Does it create a
build.gradle.kts
file? That's a piece I can help with.
👌 1
r
Yes, it creates two -- one at the root, and another in the project sources dir.
Here's the template, freshly generated from the compose multiplatform wizard
Notice that clicking through to sources on any compose UI doesn't work.
k
I've never had this problem when I was doing Java development. They only started when I started using Kotlin.
d
Hmm, I don't have the android SDK, so I can't fully build that project.
Have you tried clicking on this download sources button:
(The arrow down, with the tray under it)
r
I have, nothing happens when I press it (no progress, nothing)
k
I've just had a quick look at the issue you've submitted. In the screenshot where you specify the jar containing the sources, shouldn't that be "material-desktop-1.5.11-sources.jar"? I would expect what you have, i.e. "material-desktop-1.5.11.jar", to only contain the compiled class files.