Must-readDevOps
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
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)