Skip to content

Commit

Permalink
Initial commit with first version
Browse files Browse the repository at this point in the history
  • Loading branch information
meajinkya committed Jun 23, 2020
0 parents commit 20423ae
Show file tree
Hide file tree
Showing 13 changed files with 837 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// A launch configuration that launches the extension inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
}
]
}
3 changes: 3 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.vscode/**
.vscode-test/**
.gitignore
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.

## [1.0.0] - 2020-06-23
### Added
- Snippets for Apex Language, Aura Component Markup and Aura Component JavaScript
- Reference doc for all the snippets

[1.0.0]: https://github.com/meajinkya/salesforce-snippets/releases/tag/v1.0.0
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Ajinkya Hingne

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Salesforce Snippets <img src="images/icon.png" width="30" height="30" />

A VS Code Extension for Salesforce code snippets.

## Features

This extension will give you a lot of Salesforce code snippets which you can easily use while writing code in Apex, Aura Components and Lightning Web Components.

The [docs](https://github.com/meajinkya/salesforce-snippets/tree/master/docs) folder contains documentation listing all the available snippets.

Snippet Reference Quick Links:
[Apex](https://github.com/meajinkya/salesforce-snippets/blob/master/docs/apex-snippets.md) - List of all the Apex snippets.
[HTML](https://github.com/meajinkya/salesforce-snippets/blob/master/docs/html-snippets.md) - List of all the HTML based code snippets.
[JavaScript](https://github.com/meajinkya/salesforce-snippets/blob/master/docs/javascript-snippets.md) - List of all the JavaScript based code snippets.

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

VC Code 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

## Release Notes

### 1.0.0
This release includes snippets for Apex, Aura Component HTML and Aura Component JavaScript.

-----------------------------------------------------------------------------------------------------------
91 changes: 91 additions & 0 deletions docs/apex-snippets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Apex Snippets Reference

Following tables contains a list of the available snippets and the prefixes for them.

### Assignment
|Snippet Name|Snippet Prefix|
|------------|--------------|
|List|list|
|Set|set|
|Map|map|

### Conditional/Branching
|Snippet Name|Snippet Prefix|
|------------|--------------|
|If|if|
|If-Else|ifelse|
|Switch statement|switch|

### Loops
|Snippet Name|Snippet Prefix|
|------------|--------------|
|Traditional for loop|fort|
|Advanced for loop|fora|
|SOQL for loop|forsoql|
|While|while|
|Do While|dowhile|

### Debug
|Snippet Name|Snippet Prefix|
|------------|--------------|
|System debug without variable|debug|
|System debug with variable|debugvar|

### Testing
|Snippet Name|Snippet Prefix|
|------------|--------------|
|Test method|testmethod|
|Assert|assert|
|Assert Equals|asserte|
|Assert Not Equals|assertne|

### Aura
|Snippet Name|Snippet Prefix|
|------------|--------------|
|AuraEnabled method|auramethod|
|AuraHandledException|auraHandledException|

### Method types
|Snippet Name|Snippet Prefix|
|------------|--------------|
|Future method|futuremethod|
|InvocableMethod|invocablemethod|
|RemoteAction|remoteaction|
|Test Setup|testsetup|

### Class types
|Snippet Name|Snippet Prefix|
|------------|--------------|
|Batch|batchclass|
|Schedulable class|schedulableclass|
|Test class|testclass|
|Custom Exception|customexception|

### Exception/Error handling
|Snippet Name|Snippet Prefix|
|------------|--------------|
|try-catch|tryc|
|try-catch-finally|trycf|

### Database
|Snippet Name|Snippet Prefix|
|------------|--------------|
|SOQL|soql|
|Database.query|dbquery|
|Database.insert Single|dbinserts|
|Database.insert Multiple|dbinsertm|
|Database.update Single|dbupdates|
|Database.update Multiple|dbupdatem|
|Database.delete Single|dbdeletes|
|Database.delete Multiple|dbdeletem|

### Transaction Control
|Snippet Name|Snippet Prefix|
|------------|--------------|
|Add Savepoint|savepoint|
|Rollback|rollback|

### Other
|Snippet Name|Snippet Prefix|
|------------|--------------|
|Ternary expression|ternary|
19 changes: 19 additions & 0 deletions docs/html-snippets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# HTML Snippets Reference

Following tables contains a list of the available snippets and the prefixes for them.

## Aura Component
|Snippet Name|Snippet Prefix|
|------------|--------------|
|Aura Attribute|attr|
|Aura Method|aura-method|
|Aura Method With Params|aura-method-params|
|Init Handler|init-handler|
|Component Event Handler|compevent-handler|
|Application Event Handler|aappevent-handler|
|Component Event Register|cevent-reg|
|Aura If|if|
|Aura If-Else|ifelse|
|Aura Iteration|iteration|
|Aura Set|aura-set|
|Label Reference|label-ref|
13 changes: 13 additions & 0 deletions docs/javascript-snippets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# JavaScript Snippets Reference

Following tables contains a list of the available snippets and the prefixes for them.

## Aura Component JS
|Snippet Name|Snippet Prefix|
|------------|--------------|
|Function|aura-func|
|Call Apex Action|call-apex-action|
|Fire Component Event|fire-compevent|
|Fire Application Event|fire-appevent|
|Toast|toast-event|
|Label Reference|label-ref|
Binary file added images/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "salesforce-snippets",
"displayName": "Salesforce Snippets",
"description": "Useful Salesforce snippets to speed up writing code for Salesforce platform",
"version": "1.0.0",
"publisher": "ajinkya-hingne",
"engines": {
"vscode": "^1.31.0"
},
"categories": [
"Programming Languages",
"Snippets"
],
"keywords": [
"snippets",
"salesforce",
"apex",
"lwc",
"lightning components"
],
"contributes": {
"snippets": [
{
"language": "apex",
"path": "./snippets/apex-snippets.json"
},
{
"language": "html",
"path": "./snippets/html-snippets.json"
},
{
"language": "javascript",
"path": "./snippets/javascript-snippets.json"
}
]
},
"icon": "images/icon.png",
"homepage": "https://github.com/meajinkya/vscode-wordcount/blob/master/README.md",
"repository": {
"type": "git",
"url": "https://github.com/meajinkya/salesforce-snippets.git"
},
"license": "SEE LICENSE IN LICENSE.txt"
}
Loading

0 comments on commit 20423ae

Please sign in to comment.