salesforcedx-vscode icon indicating copy to clipboard operation
salesforcedx-vscode copied to clipboard

Switch statements do not support dashes in the conditions

Open axmav opened this issue 1 year ago • 2 comments

Summary

Switch statement is not highlighted properly in VSCode due to the dashes in the 'when' conditions. See example below.

switch on languageRFC {
            when 'de-CH' {
                language = 'German';
            }
            when 'fr-CH' {
                language = 'French';
            }
            when else {
                language = 'English';
            }
        }

Steps To Reproduce:

  1. Write apex class with this statements
  2. See red highlights on a correct statement.

Expected result

Not highlighted in red.

Actual result

Highlighted in red. VSCode think this is an error. Replacing dashes with underscores help.

Additional information

Screenshot 2023-08-15 at 13 54 43

Salesforce Extension Version in VS Code: Apex v58.9.1

SFDX CLI Version:

OS and version: MacOS

axmav avatar Aug 15 '23 10:08 axmav

Hi @axmav, Thank you for your feedback. We will let you know if we provide a fix for this issue.

daphne-sfdc avatar Aug 16 '23 19:08 daphne-sfdc