Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>Salesforce Code SnippetsNew to Visual Studio Code? Get it now.
Salesforce Code Snippets

Salesforce Code Snippets

Gurjit Singh

|
2,915 installs
| (4) | Free
Code Snippets for Apex and LWC (HTML, Javascript and XML)
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Salesforce Code Snippets

It includes code snippets for Apex and LWC (HTML, Javascript, graphQuery, CSS, and XML).

Features

Demo

Glossary

LWC (HTML)

  • tpi: template lwc:if
  • tpf: template lwc:elseif
  • tpe: template lwc:else
  • tpf: template if:false
  • fore: template for:each
  • itr: template Iterator:it
  • lgin: lightning-input
  • lgic: lighting-icon
  • lgbb: lightning-button with brand variant
  • lgbo: lightning-button with brand-outline variant
  • spin: Lightning spinner with template if true
  • sldstable: HTML table with slds selector including one th and td tag.
  • lgcard: Lightning card with custom title
  • paginator: Generate code for pagination.
  • grid: SLDS grid.
  • gridcenter: SLDS grid with center align.
  • gridspace: SLDS grid with space align.
  • gridspread: SLDS grid with spread align.
  • gridend: SLDS grid with end align.
  • bumpleft: SLDS bump left.
  • bumpright: SLDS bump right.
  • aligncenter: SLDS align absolute center.
  • sldsmodal: SLDS Modal.

LWC (Javascript)

  • con: class constructor
  • clg: console.log()
  • cle: console.error()
  • clc: console.clear()
  • func: method()
  • edc: export default class()
  • wrmt: wire method
  • cmt: method comments
  • clt: class comments
  • toast: showToast method
  • dce: dispatch custom event
  • imap: import apex
  • imcl: import custom label
  • imsr: import static resource
  • imob: import sObject
  • imcr: import create record
  • imur: import update record
  • imdr: import delete record
  • imst: import showToastEvent
  • imld: import loadStyle and loadScript
  • impv: import getPicklistValues
  • imgq: import gql, graphql, refreshGraphQL
  • imra: import refreshApex
  • imna: import Navigation
  • imf: import file
  • qsl: query selector using data id
  • nvur: navigate to url method
  • paginator: Generate code for pagination.
  • arrow: Creates named arrow method.
  • etv: event.target.value
  • etc: event.target.checked
  • etd: event.target.dataset.id
  • jst: JSON.stringify()
  • jsp: JSON.parse()
  • jspt: JSON.parse(JSON.stringify())
  • getrec: LDS get record.
  • create: LDS create record.
  • update: LDS update record.
  • delete: LDS delete record.
  • tcf: try catch and finally block.
  • pick: getPicklistValues wire handler.
  • gqy: Sample graph query.

LWC (CSS)

  • btnbrand: Changes the lightning button color.
  • icnutl: Changes the lightning icon color.
  • fds: field set selectors
  • brc: brand color

LWC (XML)

  • tgts: targets
  • dgts: design attributes to use in the app builder

Apex

  • pvm: public void method
  • psm: public string method
  • pim: public integer method
  • plm: public object[] method
  • psem: public set method
  • pmm: public Map method
  • arm: Aura Enabled method
  • armc: Aura enabled method with cacheable true
  • arp: Aura enabled property
  • syd: System.debug()
  • cmt: method level comment
  • clt: class level comments
  • batch: Apex batch class skeleton
  • singleEmail: single email message
  • saveResult: Save result with database.dml type along with success and failed result
  • req: Http request callout
  • soql: SOQL statement

Visualforce

  • lgtout: lightning out code to call aura or lwc on vf

Developer

Gurjit Singh https://www.linkedin.com/in/gurjitssingh/

Enjoy!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft