// My Section -----------------------------------------------------------------
The above is the desired result.
Imagine this scenario
// ----------------------------------------------------------------------------
// firebase
// ----------------------------------------------------------------------------
// utils
It is possible to trim lines to a certain length using for example this regex /(^.{20}).*$/$1/
, which will give
// -----------------
// firebase
// -----------------
// utils
But what if I want to fill the other lines instead up to the set length like this in one run? Is that possible?
- one regex for only the right fill, not the trim
// ----------------- // firebase -------- // ----------------- // utils -----------
Ages ago, I was doing some regex ninja challenges and we were supposed to do math, so.... regex is magical.
What I am ultimately trying to achieve is a VSCode snippet that allows me to write: My Section --
then trigger a snippet that transforms the inserted text into an 80 character wide comment containing
// My Section -----------------------------------------------------------------
https://code.visualstudio.com/docs/editor/userdefinedsnippets