Reformat SOQL in Apex - 1 Field per line
Some way to reformat this: acr = [SELECT Id, Roles, Roles_Portal_Viewable__c FROM AccountContactRelation WHERE Id = :acr.Id LIMIT 1];
to:
acr = [
SELECT
Id,
Roles,
Roles_Portal_Viewable__c
FROM AccountContactRelation
WHERE Id = :acr.Id
LIMIT 1
];
Comments (6)
-
reporter -
repo owner - changed status to open
Thanks for logging this. I’ve been thinking about something similar myself, at a minimum a code intention to put each selected field/function on its own line just like the ones that exist for formal parameters/arguments.
-
repo owner Okay, I’ve committed new code intentions to easily split even more delimited lists one per-line or consolidate them onto a single line similar to what was already present for method formal parameters and invocation arguments. In particular, I’ve added support for the following:
- SOQL
SELECT
clause items - SOQL
GROUP BY
clause fields - SOQL
ORDER BY
clause fields - SOQL
WHERE
clause logical expressions - SOQL
WHERE
clause parenthesized value sets - Apex composite (logical and arithmetic) expressions
- Apex array/list and map initializer entries
Here’s a short example of the SOQL-specific ones:
These should all be in this week’s build, likely for release on Thursday.
- SOQL
-
reporter @Scott is that going to work within the Apex editors too?
-
repo owner Yes, absolutely. It’s all the same editor, just used in different contexts. All of the enhancements described above will work in the standard Apex editor including for embedded SOQL queries.
-
repo owner - changed status to resolved
Delivered in 2.2.8.9.
- Log in to comment