Idea: IntelliJ plugin to show thumbnails of sketches

Hi! Now that I’m getting closer to 200 OPENRNDR sketches I struggle to remember which one is which.

I thought that it would be very useful to have a plugin for Idea to show thumbnails of sketches and load the code by clicking on the image. It would be like the current list of files on the left pane, but with images above each .kt file.

Here are the instructions to create a plugin: Building Plugins with Gradle—IntelliJ Platform Plugin SDK Has anyone tried this before? I haven’t yet.

There is one open source plugin which might serve as inspiration: https://plugins.jetbrains.com/plugin/7874-android-drawable-viewer

Maybe it could even become the OPENRNDR plugin if other useful features are developed (snippets? shadeStyles? Built-in guide?)

What do you think? Would this be a useful addition?

3 Likes

I thought about embedding some base64-encoded metadata into the top of the file.

Or your idea was about generating pictures dynamically?

Metadata yes, but I thought about putting a path to an image. Something like

// @thumb="/my/thumb.jpg"

Base64 might look noisy for a meaningful 24bit thumb, or?

Yeah, I like your option more. Alternative is to keep images data in a separate folder and generate uuids for sketches instead (for linking).

I thought of automating it too, but I often rename my sketches. Well maybe we can have different options, like first look at the metadata, if it’s not there, look in a folder for a png with the same name as the .kt file.

I realized I never posted about this again. Actually I made the plugin work (for me) and have been using it for over a year.


Thumbnailer plugin panel on the right, a floating preview pane on the center.

Source code

You can find a download under Releases, but only after reading the readme, please! :slight_smile:

The fact that the plugin stores metadata as a comment in your Kotlin files has advantages and disadvantages:

positive

  • The metadata is easy to sync across computers because it ends up in your repo. It’s not in a hidden internal IDE database, which would be harder to sync.
  • Seeing it at the top of your file invites you to write a description for your program, which can help you understand it later.
  • You can rename the Kotlin files outside of the IDE and the thumbnail stays in sync, because the metadata wouldn’t change.

meh

  • A plugin that edits your code might be considered heresy by some :slight_smile:
  • It could potentially mess up your code if I did it wrong.

Maybe where to store the metadata could be user selectable?

If I receive feedback and make it user friendlier (an about screen? an integrated user manual? More configurable?) I could release it in the market to make it easier to install.

Coming features

  • I’m adding a feature to update the readme.md of the currently open project to show the thumbnails with links to each programs. Something like what you can see in this repo. In other words, it’s a bit like bringing the side panel with all the thumbnails online so other people can also see them and find the source code for each program.
  • Grid view, instead of only one column. That would help see more thumbnails simultaneously, less scrolling.