Skip to content

Useful Salesforce snippets to speed up writing code for Salesforce platform

License

Notifications You must be signed in to change notification settings

meajinkya/salesforce-snippets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Salesforce Snippets

A VS Code Extension for Salesforce developers. Visual Studio Marketplace Installs

Features

This extension will give developers a lot of Salesforce code snippets which can be easily used while writing code in Apex and Aura Components to write code faster.

Available Snippets

Apex Aura Markup Aura JavaScript LWC
Tip: Click on above badges to open the list of respective language snippets and their prefixes.

Few commonly used Salesforce snippets

Snippet Name Snippet Prefix Language
List list Apex
Map map Apex
Advanced for loop fora Apex
System debug without variable debug Apex
Test method testmethod Apex
Init Handler aura-init-handler Aura Markup
Aura Iteration aura-iteration Aura Markup
Call Apex Action aura-call-apex-action Aura JavaScript

But those are not all the snippets! To explore all the other snippets available in the extension, go to the docs folder.
The Available Snippets section has direct links to language wise snippet reference.

How to use?

  • After installing the extension in VS Code, the snippets will start appearing automatically when a file with appropriate language is opened.

  • Each snippet has a really short trigger text/snippet prefix which you can type in and VS Code IntelliSense will show the available snippets.

  • For example: if you are writing an Apex Test class and want to write a new test method:

    • type testmethod
    • press Tab or press Enter when VS Code shows the list of snippets ... and a test method with placeholders will be inserted in your class!
    Note: tabCompletion option in VS Code must be enabled for this to work with Tab press.

The snippets will be added continuously as and when we find more use cases. Any feedback and pull requests are welcome.

Installation

Extension installation is as easy as clicking a button from Extensions window in VS Code. To install,

  1. Go to File > Preferences > Extensions or press Ctrl + Shift + X
  2. Search for Salesforce Snippets
  3. Click Install

If you see any issue(s) or have any enhancement request(s), feel free to create an issue on GitHub.

Happy coding! ❤

About

Useful Salesforce snippets to speed up writing code for Salesforce platform

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •