vscode-snippets is a collection of useful snippets for VS Code.
I created many of these snippets with this helpful snippet generator tool.
console.log()
import
- Snippet to create a Subject, sendSubject function, + getSubject function
Testing
beforeEach
describe
expect
it
toBe
toEqual
toHaveBeenCalled
toHaveBeenCalledTimes
toHaveBeenCalledWith
createSpyObject
spyOn
- Week Planner template
- Month Planner template
- Quarter Planner template
- Day Planner template
- Reference section
- Footnote
- Markdown link
- Markdown link with the link title filled in with clipboard contents (e.g.,
[pasted from clipboard]()
) - Markdown link with the link url filled in with clipboard contents (e.g.,
[](www.from-my-clipboard.com)
)
- container class
div
ngClass
ternaryclass
ngFor
div
(click)
- Height and width 100%
:host
height and width to 100%- Set default values of html and body
Shorthand
flex
flex-direction
justify-content
align-items
background-color
margin-left
margin-right
margin-top
margin-bottom
To add any of these snippets to your own VS Code editor:
- Open the Command Palette (
cmd
+shift
+p
on Mac,ctrl
+shift
+p
on Windows). - Search for and select
Preferences: Configure User Snippets
. - A list of languages will appear and you can browse or search for the language of the snippet you want to add. Select that option.
- A
<language_name_or_extension>.json
file should show up. - Between the top level set of curly braces, (e.g.,
{ }
), copy-paste the snippets you want to add. ** - Save your file and your new snippets will be available to use when you have a file of the corresponding language type open.
There are various user settings that may interfere with editor suggestions behavior (which can include snippets). Check out your settings.json
(global and/or workspace-level if applicable) to see if you have anything configured that might suppress editor suggestions.
To quickly access your settings.json
, open the Command Palette (cmd
+ shift
+ p
on Mac, ctrl
+ shift
+ p
on Windows) and search for settings
and select Preferences: Open Settings (JSON)
. You may be able to diagnose problems through the UI-based settings page if you prefer to work with that.
Double check that your snippet file is valid json
or jsonc
(e.g., make sure each snippet entry is separated from the next snippet with a comma, etc).
It can be frustratingly difficult to spot an issue with json
, so I find this online JSON validation tool to be super helpful in diagnosing problems with snippets and settings.json
. Note: the validation tool will complain about comments, so if you are using jsonc
, keep that in mind.
There might also be something off with my snippets, so feel free to submit an Issue if you'd like me to check it out!