With `0.5.0-build229` we implemented new experimen...
# compose-desktop
o
With
0.5.0-build229
we implemented new experimental feature we’d like people to experiment with and help us to get improved. Namely basic non-interactive preview. To use, switch to
0.5.0-build229
and add
implementation(compose.uiTooling)
into
dependencies
block. Then install IDE plugin from https://plugins.jetbrains.com/plugin/16541-compose-multiplatform-ide-support/versions/alpha/125571. Add
@Preview
annotation to argument-less
@Composable
function and you’ll have gutter like shown below. Click it and function preview could be seen in “Desktop Preview” pane of IDEA. Thanks to @alexey.tsvetkov for getting that up and running! Known issues: • put function with
@Preview
to file where no
main()
function exists, as it conflicts with run configuration. We plan to fix it soon. • preview creates stale run configurations. We plan to fix it soon. • preview pane doesn’t look eye candy • running preview requires two clicks • no automated re-running of preview on code change Anyway, share your experience, and maybe help with improvements, code is at https://github.com/JetBrains/compose-jb/tree/master/idea-plugin
K 21
🎉 33
c
Tried to install from AS Bumblebee C2. Edit: Installed fine in arctic fox
Okay. I'm in arctic fox. downloaded plugin. Tried adding compose.uiTooling but it didn't find it. Updated version to 0.5.0-build229 and then it found uiTooling. 👍 Added a composable in a file without a main function and I get this. path of file:
/src/commonMain/kotlin/App.kt
block where I added uiTooling:
Copy code
kotlin {
    android()
    jvm("desktop")

    sourceSets {
        named("commonMain") {
            dependencies {
                api(compose.runtime)
                api(compose.foundation)
                api(compose.material)
                implementation(compose.uiTooling)
            }
        }
    }
}
d
I have the problem that 229 transitively depends on:
androidx.activity:activity-compose:1.4.0-alpha01
...while this version of
activity-compose
is not resolvable. Do we need to add a new repository? I already have Google, Maven Central and JetBrains Compose Dev repo registered.
o
could be an issue with Android artifact publishing, will try to fix with next dev build
unable to reproduce this problem - could you please explain how to see it?
c
@olonho ws that directed to me? I'm not sure why I can't get preview working in desktop. It seems to be configured correctly. Thanks in advance
o
I asked @darkmoon_uk
c
Okay. Nikolay Let me know if you have any tips for me or if I should just open up a bug on github.
o
Please open an issue
c
Done https://github.com/JetBrains/compose-jb/issues/846 And opened another one for bumblee plugin installation issue for good measure. https://github.com/JetBrains/compose-jb/issues/847
e
Preview only works for the first launch. After wards, it keeps showing the preview of the first run. The only way to preview another composable is to restart my IDE. Is this a known bug?
o
cc: @alexey.tsvetkov
a
@Erlinde please tell your OS and versions of Compose IDE and Gradle plugin? Recently we fixed a similar bug on Windows (should be fixed with 0.5.0-build253)
e
Windows, Compose 0.5.0.235, Gradle 6.9. I just tried 0.5.0.253 but there preview doesn't work at all. Does this have to do with my gradle version?
a
@Erlinde do you use the same version of Gradle and IDE plugin?
e
Yes, Gradle 6.9 and the latest update of the IDE plugin
o
Alex meant if build script in project also uses same version of Compose as one in IDE plugin?
e
Right, yes. In the build script I'm using 0.5.0-build253. The IDE plugin displays 245 --> 253. Am I missing something basic here?