Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Richards Apex StuffNew to Visual Studio Code? Get it now.
Richards Apex Stuff

Richards Apex Stuff

Richard Corfield

|
66 installs
| (0) | Free
Small utilities to work with Apex
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

m0rjc-apex-stuff README

Richard's internal use collection of tools for working with Apex.

Features

  • Create Apex Class using templates.
  • Some snippets

Requirements

None yet.

Extension Settings

  • m0rjc-apex-stuff.createClass.apiVersion: force classes to specify the given version in their metadata. For example 46.0
  • m0rjc-apex-stuff.createClass.defaultApiVersion: provide a default version for use if we cannot find the SFDX config.
  • m0rjc-apex-stuff.createClass.templates: provide class templates using VSCode's Snippet feature.

Templates

The property m0rjc-apex-stuff.createClass.templates contains a map of template name to definition. The definition is a JSON object with properties:

  • matches: a glob specifying class names for which this template is most appropriate. The longest matching template is offered as default.
  • body: An array of lines. See https://code.visualstudio.com/docs/editor/userdefinedsnippets for syntax. The snippet will be invoked with the class name as ${TM_SELECTED_TEXT}.

The plugin will provide a template called Empty Class by default. This can be overridden.

Example:

"m0rjc-apex-stuff.createClass.templates": {
    "Empty Class": {
        "matches": "*",
        "body": [
            "/*",
            " * Copyright ${CURRENT_YEAR}",
            " */",
            "",
            "${1|public,public virtual,public abstract,global,global virtual,global abstract|} ${2|inherited,with,without|} sharing class ${TM_SELECTED_TEXT}",
            "{",
            "$0",
            "}"
        ]
    },
    "Service Class": {
        "matches": "*Service",
        "body": [
            "/*",
            " * Copyright ${CURRENT_YEAR}",
            " */",
            "",
            "${1|public,global|} with sharing class ${TM_SELECTED_TEXT}",
            "{",
            "    public interface API",
            "    {",
            "        $0",
            "    }",
            "",
            "    @TestVisible",
            "    private static API s_service;",
            "",
            "    private static API service()",
            "    {",
            "         if(s_service == null) s_service = new ${TM_SELECTED_TEXT}Impl();",
            "         return s_service;",
            "    }",
            "}"
        ]
    }
}

Known Issues

The Create Class tool was designed for right click use. Click on a class folder or class in that folder and it will target that folder. If you use the command pallette you will be presented with a basic file dialog to locate the folder to work in. This can be improved.

Release Notes

0.0.1

First usable Create Class with templates.

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