-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Line Breaks off of Static Queries in a SObject Constructor #319
Comments
Thanks for the bug report, I agree that the current format does not look right, but we need to think a bit more about the expected output. For example, what if the property chain after the SOQL query is really long, like this:
In my mind it makes sense to format it this way:
Maybe we should allow breaking it up if there are more than 1 property in the chain, but keep it on the same line if there's only 1. This is very early thought from me though, I have to dive deep into the current implementation to see what it's doing, and how complicated it would be to add this type of behavior. |
You're right, it gets tricky if there is a long query and a long chain of properties. I can't see a good way to break up both the query and the property chain across lines. This might be another option for formatting it. I think the query is likely to be longer than the property chain, so this approach might look better in a larger number of scenarios?
Or to get even more complex...
That sounds like it might be a pain to implement 😅 |
You may be aware already, but I just realized this issue applies to all static queries, not just those in an SObject constructor. Example below. Input [SELECT Another_Test_Object__r.Yet_Another_Test_Object__r.Account.Id FROM Test_Object__c LIMIT 1].Another_Test_Object__r.Yet_Another_Test_Object__r.Account.Id; Output [SELECT Another_Test_Object__r.Yet_Another_Test_Object__r.Account.Id FROM Test_Object__c LIMIT 1]
.Another_Test_Object__r.Yet_Another_Test_Object__r.Account.Id; |
# Prettier options (if any): none
Input:
Actual output:
Expected output:
Even if the query was longer to where it needed to be split across multiple lines, I still think the
.Id
should not be on its own line.Additional information (please fill this out):
The text was updated successfully, but these errors were encountered: