One Tip for Developers — Use the Indent Rainbow Plugin | by Madeleine Smith | Jun, 2022

No extra grief when working with pesky openapi.yaml recordsdata

A feature image consisting of ‘Indent Rainbow’ as text on a background of multiple bands of bright colors

I not too long ago found the IDE plugin Indent Rainbow while attempting to unravel a frustration I’d been experiencing when working with openapi recordsdata.

With one in all my purchasers, I’m working with a big openapi.yaml file. This file defines our API and describes every of our endpoints in minute element – request parameters, our bodies, anticipated responses, and many others. Although I at all times discovered pasting code into this file was a mildly irritating expertise.

Having the right indentation is essential in YAML recordsdata, which means that to stick the code in the appropriate place, I used to be having to both rely the variety of indentation pointers from the left or observe a particular line down with my cursor. Neither of those is nice! Additionally, my IDE (Goland) at all times appears to mess up the indentation at any time when I paste, however that’s a special story!

So I wished to discover a plugin that will make this a bit simpler. And Indent Rainbow appeared to suit the invoice. Indent Rainbow is a plugin for IDEs (e.g. JetBrains products and VS Code) that colours every of your indentation ‘steps’. And this, in flip, makes the indentation simpler to learn.

So, for instance, that is how one of many recordsdata I’m engaged on as a part of a side project seems to be like in my IDE:

A screenshot of code in my IDE with each indentation step colored in a pastel color
The above file is used to regulate the colour and brightness of a sensible bulb — see the gorgeous indentation colours on the left 🥰

Nevertheless, Indent Rainbow is, by default, disabled on recordsdata with over 1000 strains. This setting might be overruled, although I had beforehand discovered it to be extremely sluggish when engaged on an openapi file of virtually 6000 strains. And this meant that, frustratingly, I’d have to depart the plugin disabled for big recordsdata and thus my authentic downside would stay.

(╯°□°)╯︵ ┻━┻

Nevertheless, as of the time of writing, it might appear this has been fastened as working with massive recordsdata is not deathly sluggish. Whoop! Now I believe I’m going to depart this plugin enabled on a regular basis — even for big recordsdata 💯

More Posts