/apex-snippets

A bundle of Sublime Text 3 snippets for apex

MIT LicenseMIT

Apex Snippets

This is a comprehensive collection of Sublime Text snippets for developing Apex.

This is the Sublime Text 3 version

Installation

Clone this repository in your sublime packages directory.

To navigate there:

Sublime Text -> Preferences -> Browser Packages

Getting Started

In order to make best use of these snippets, I would recommend reading them.

Here are a few good ones to start with.

Documenting Code

When documenting a file, use /*f

When documenting a method, use /*

When documenting a test method, use /*t

Methods

You can create apex methods with method

For void methods, use the very similar vmethod

For test methods, use test

For test factory methods, use trm

Assertions and Debug

Use assert for plain assertions

Use asserte for equality assertions

Use debug for debugging

Visualforce

When adding Page messages in your controller (Error, Info, Fatal, Warning):

To construct a standard controller, use Aps

To construct a standard set controller, use Apss

Queries and DML

For a quick inline query use query

For a larger query use querybig

For a try catched insert with rollback, try tcd