A custom snippet is a template that allows you to easily enter repeated code patterns. This Snippet Generator by Pawel Grzybek makes it easy to create your own for VS Code, Sublime, & Atom.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (22)
My most used for PHP / Symfony development are:
ecd (echo dump die):
echo '<pre>';
\Doctrine\Common\Util\Debug::dump($END$);
exit(__FILE__ . ' on Line ' . __LINE__);
vdd (var dump die):
var_dump($END$);
exit(__FILE__ . ' on Line ' . __LINE__);
pdd (print dump die):
echo '<pre>';
print_r($END$);
exit(__FILE__ . ' on Line ' . __LINE__);
When i need to debug they are big timesavers!
I like the inclusion of line numbers. Might steal that.
Yeah I was doing that:
Useful for debugging.
My big three are:
console.log([Cursor Here])
I use a console.log() snippet all the time.
As an added bonus I put a matching variable/value cursor like this:
console.log("[Cursor Here]", [Cursor Here])
I like this idea for when I'm not using Turbo Console Log.
Tip 3 is great. Is it for vim or vscode maybe?
I use it on VS Code. :)
I can be happy with snippets just for function definition, ifs and console.log.
While using a pluginless vim these abbreviations are timesavers:
I utilize quite a few snippets. Here are the ones I use most often with JS/TS:
"af" for arrow functions:
() =>
"afb" arrow function body:
() => { }
"desc" for jest describe block:
describe('', () => { })
"it" for jest it block:
it('', () => { })
"imp" for normal import
"imn" for import named
"ima" for import as
"c" for scaffolding a full class
"ctor" for a constructor
For those using WebStorm or IntelliJ variants, here is a nice starter that I came across: github.com/blakedietz/js-live-temp...
I like using a line of dashes to separate logical chunks of code in my classes (related methods, public vs private methods, fields, constructors, etc.). I have
//-
expand on tab to a full line of dashes and place the cursor above it to quickly add a comment.Here's the "Live Template" used in the IntelliJ products:
tsrsfc
: produces a functional component for React with TypeScript.ac-api-action/-delete/-post/-put
: produces a stubbed REST APIs for .net Core.:shrug
gets me ¯\(ツ)/¯I've got
/shrug
set up via Alfred so I get ¯_(ツ)_/¯ anywhere and everywhere. I also made it a keyboard shortcut on my phone. 😂impd gives me:
The cursor starts in the path and then moves to the braces so that I can tell it where I want it from and then what I want.
Changes somewhere along the line have made the intellisense a little wonky, but it used to pop up with options immediately without me having to press Ctrl + Space.
I have a few others set up as well, such as impa which expands to:
Ooh this one is handy! Might need to add it to mine.
About the only one I use is this:
which is basically the equivalent of everyone's console.logs but for PHP.
I'm not big on snippets. I've tried them and never got the hang of them!
I have a few here (even if it requires an update !)
Not using any snippets but everytime I type a non-breaking-space by accident (Alt+Space) I have it replaced by a normal space. On QWERTZ-Keyboards, this happens if you type "function() {". I wasted lots of time hunting those.