The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

Must-read

A raw List in an @InvocableMethod stops Apex completion across the whole file (opens in a new tab)

You will learn how a raw List parameter in an @InvocableMethod crashes the Apex language server and disables member completion in the file, which signature shapes trigger it, and how the author's VS Code extension detects and fixes them.

Raw List in @InvocableMethod

  • Server logs IllegalArgumentException
  • Completion lost across the whole file
  • Shape not checked against element type

Raw List in plain method

  • Only a syntax error is reported
  • Completion keeps working
  • Harmless, so not flagged
Raw List parameters break completion in invocable methods but not in ordinary ones

The author wrote an @InvocableMethod with a raw List parameter and found that member completion stopped working throughout the class, while the Problems panel showed only a generic syntax error. The cause is an exception inside jorje, the Apex language server in the Salesforce Extension Pack. For invocable, static @AuraEnabled, @Http and global methods, the server unwraps the element types of collection parameters and expects exactly one type argument, so a raw List produces an empty list and the check fails.

To separate harmful shapes from harmless ones, the author ran the language server headless against 274 signatures and recorded whether it logged an exception and whether completion came back empty. A raw List in an invocable method crashed the file, as did List, unfinished forms and wrong argument counts. A raw List in an ordinary method was only a syntax error with completion intact, and Set and Map in invocable methods were clean. A raw collection as a return type makes the parser drop the method, which limits the damage to that method.

The author’s extension, Virga, flags only the shapes that broke, using two diagnostic codes, and offers quick fixes that insert a type such as List chosen from the file. After applying the fixes, the server stopped throwing in all 184 breaking cases and completion returned in 180 of 181 where it had failed.

Read the original at dev.to (opens in a new tab)

Worth reading?

A VS Code extension runs anonymous Apex and SOQL with a single keyboard shortcut (opens in a new tab)

Readers will learn how to install and configure Virga to execute throwaway Apex and SOQL scripts without leaving the editor.

Why read this

The piece also explains how the extension resolves common language server completion issues and disables telemetry during local runs.

Virga is a free VS Code extension designed to streamline the execution of throwaway Apex and SOQL scripts directly within the editor. Setup requires VS Code version 1.90 or newer, the Salesforce CLI on the system path, and an active Salesforce DX project. Users create dedicated scratch tabs for either language, trigger execution with a keyboard shortcut, and receive formatted output showing compilation status, debug logs, governor limits, or flattened query results.

The tool handles execution through a temporary file copy rather than direct command line arguments, which prevents partial edits from affecting the run. It achieves a seamless experience by applying a brief auto-save delay that clears tab dirtiness markers, allowing instant closure without save prompts. Scratch files persist in a version control ignored folder and survive editor restarts, while conflicting keymaps are handled to preserve the shortcut exclusively for scratch contexts.

Beyond basic execution, the extension patches gaps in the standard Salesforce Extension Pack. It adds completion support for inner types declared in the same file, identifies and offers quick fixes for parameter shapes that crash the language server, and supplies missing snippets for annotations and user mode operations. Privacy is maintained by automatically disabling Salesforce CLI telemetry for each run, though administrators can enforce global telemetry suppression through standard configuration commands.

Read the original at dev.to (opens in a new tab)

Worth reading?