Skip to content

Use Anonymous Apex Scratch in VS Code

Guided help

Open a scratch Apex file, run it locally, and read the generated debug log.

  • Open a small scratch editor.
  • Run the whole buffer.
  • Use the active local DB.

Before you start

  • VS Code is running with a clean VS Code profile.
  • Only Glade, Catppuccin Mocha, and the Salesforce Apex extension are installed.
  • The active Glade local data environment is the one you want to write to.

Steps

1. Open the scratch buffer

Open an anonymous Apex scratch buffer or a small .apex scratch file.

VS Code showing an anonymous Apex scratch buffer

2. Run or debug the Apex

Use Cmd+Enter on macOS or run glade exec --debug-log - --project . <apex>. Select a smaller block when you want to run only part of the buffer.

Expected: Glade runs local anonymous Apex against the active DB and prints a Salesforce-style debug log.

VS Code showing an anonymous Apex debug log

Common wrong turn

If the command says no SFDX project is open, open the project root folder, not a single .cls file.

Next

Glade is local-first Apex tooling.