I seem to remember seeing a tutorial or sample or ...
# compose-desktop
z
I seem to remember seeing a tutorial or sample or something once for writing an IntelliJ plugin’s UI with Compose. I can’t figure out the right things to google apparently – does anyone know where to find this? Or did I just imagine it?
c
z
aha, awesome! thank you
c
You’d probably want to use the official Intellij Plugin Template as a base, and just port the config from that example into the official template to get CI/distribution/etc. all configured for you https://github.com/JetBrains/intellij-platform-plugin-template
🙏 2
c
@Chris Sinco [G] I know you wrote a plugin with compose and it's officially in the plugin repository. Did you start with the compose jb plugin template, or the jb plugin template and THEN add compose to it?
c
I started with the IDEA plugin example in the repo, that is linked above from Kirill. I did run into my own setup issues, so I actually created my own template 😆 https://github.com/c5inco/Compose-Desktop-Plugin-Template
😄 1
I added small things like additions to the Gradle tasks that update the plugin metadata (for publishing purposes), and adding this line by default to ensure I don’t run into the resource loading issues:
Thread.currentThread().contextClassLoader = PluginAction::class.java.classLoader
I also added some boilerplate for loading Compose UI in a tool window, which is not in the original template since it only covered modal dialogs: https://github.com/c5inco/Compose-Desktop-Plugin-Template/blob/main/src/main/kotlin/com/google/adux/template/plugin/MyToolWindowFactory.kt
👍 2
z
awesome!
c
One thing that I overlooked before was the theme change listeners from Swing: https://github.com/JetBrains/compose-jb/tree/master/examples/intelliJPlugin/src/main/kotlin/com/jetbrains/compose/theme/intellij That was super useful to circle back to in order to properly pull colors from the IDE and change the theme of my Compose UI to match dark versus light in the IDE.
👍 2