I am new to salesforce DX. When I am working with Visual Studio Code, after installing the recommended extensions like Salesforce Extension Pack and Salesforce CLI Inegration, the IDE is able to give hint for the sObject.

However, the wrong object assignment like

        Bot_Command__c a = new Bot_Command__c();
        a.Pattern__c = 1.0;

Pattern__c supposed to be text but it is assigned with a Decimal value but there is no detection of wrong assignment in Visual Studio Code. enter image description here Would you please advise if there is any command from Salesforce CLI or the command in Visual Studio Code to compile these kinds of error before I pushing the code to Scratch org?


  • 1
    Hi Minh, all Apex code handling is done on the org - it is here that it gets "compiled". In essence, if your IDE doesn't provide enough intellisense, the way to check for "compilation errors" is actually to push to the org.
    – Phil W
    Jul 9, 2019 at 16:55
  • Hi Phil W, thanks a lot for your advice! Yay, pushing to the org helps to detect the error!!!!
    – Minh Tran
    Jul 9, 2019 at 19:07

1 Answer 1


As mentioned in the comments. Apex code isn't typically compiled until it is deployed as metadata to an actual Salesforce Org.

If you were to push this file to a scratch org via the SFDX CLI it would report the type error back.

In terms of Apex awareness within VSCode, that is primarily handled by the Apex Language Server.

The Apex Language Server is an IDE-agnostic way for tools to access code-editing capabilities such as code completion, go to definition, find all usage, and refactoring.

If it isn't working as expected check the Troubleshooting Common Issues page.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .