A short tutorial to make writing code a little faster
I’m in the habit of scattering print
statements around my code. This saves from having to step through a debugger to see what the code is doing. In the Dart language, it looks like this:
print('message');
Everything but the message
inside the quotes is just boilerplate code that I have to type over and over. It gets kind of tiring and I’m slow because my fingers still don’t remember where the ( )
parentheses are on the keyboard. Even the autocomplete function in VS Code doesn’t give me what I want because after I’m finished typing the message inside the quotes, I still have to reposition the cursor at the end of the line so that I can add the final ;
semicolon.
What I want is a shortcut that will give me the following:
print('|');
with my cursor positioned right between the quote marks. That would save me a ton of time. Well, it would save me like 3 seconds, … but those seconds add up, you know!
I remember back when I was using the IntelliJ-based Android Studio for Flutter development, you could add custom code snippets (some prewritten code) with a shortcut. Those were called Live Templates. I later switched to VS Code and have been happy with the change. I wrote about the…