- edited description
Code Completion in SWITCH statement doesn't work properly
Hello,
I have a class with constants (public final string) and I would like to use these values in the SWITCH statement, but unfortunately, code-completion doesn’t work.
For example:
switch on expression {
when Constants.CONSTANT_NAME {
somefunction();
}
After I type Constants. nothing happens.
Comments (4)
-
reporter -
repo owner Is that a legitimate usage of the
switch
statement? When I try that and deploy, it fails as follows:
Apologies if I’m missing something obvious here.
-
reporter Okay, it looks like my fault because I didn’t try to push that changes (with switch) and updated code to use if else.
There is an Idea to allow this https://ideas.salesforce.com/s/idea/a0B8W00000GdWgHUAV/add-support-for-final-variables-in-switch-statement-when-clauses
So you can close the ticket.
Thank you. -
repo owner - changed status to resolved
Okay, thanks for confirming. I keep an eye on all enhancements delivered in each Salesforce seasonal release and update IC2 as appropriate for those enhancements. If/when that idea is delivered, I'll update IC2's parser, code completion, etc., to provide full first-class support for it. Thanks again!
- Log in to comment