Here’s some information on how to get past roadblocks that you might encounter while using Salesforce Extensions for VS Code.
SFDX Commands Aren’t Available
If you don’t see any SFDX commands in the command palette, make sure that you’re working on a Salesforce DX project and that you have the latest version of Salesforce CLI.
- Make sure that the root directory you have open in VS Code contains an
sfdx-project.jsonfile. If you haven’t set up a Salesforce DX project, check out Project Setup in the Salesforce DX Developer Guide.
- Update Salesforce CLI, as described in the Salesforce DX Setup Guide.
Set Your Java Version
See: Java Configuration
Set Salesforce CLI Path (Windows)
See Installing the Salesforce CLI. After installing Salesforce CLI, if you get the error ‘Salesforce CLI is not installed’, most likely Salesforce CLI is not added as a path variable. To verify or add Salesforce CLI to your Windows path variable:
Edit the system environment variables.
System Properties, click
User Variables, double-click
Verify Salesforce CLI is listed as an entry. Otherwise, click New and paste the path where you installed CLI. For example,
C:\Program Files\Salesforce CLI\bin
Monitor Apex Language Server Output
The Apex Language Server is an implementation of the Language Server Protocol 3.0 specification. The Language Server Protocol allows a tool (in this case, VS Code) to communicate with a language smartness provider (the server). VS Code uses the Apex Language Server to show outlines of Apex classes and triggers, code completion suggestions, and syntactic errors. To see all diagnostic information from the Apex Language Server, select View > Output, then choose Apex Language Server from the dropdown menu. The diagnostic information gives you insights into the progress of the language server and shows the problems encountered.
Activate the Apex Language Server
If the Apex features aren’t available, activate the Apex Language Server. In the VS Code menu bar, select View > Output and select Apex Language Server from the drop-down list on the right. If you don’t see an “Apex Language Server” entry, the language server didn’t activate.
If the Apex Language Server didn’t activate, ensure that you’ve:
- Opened a Salesforce DX project that has a valid
- Opened the Salesforce DX project as a top-level folder.
- Installed Java 8 or Java 11; you’ll see a warning if neither version is installed.
If you’ve checked all of the above and nothing is working, check for errors in VS Code itself. In the VS Code menu bar, select Help > Toggle Developer Tools, click Console, and search for relevant messages.
See Debugger Errors
To see errors generated by the debuggers, add
"trace": "all" in your
launch.json file. Then, re-run your scenario to view debugger log lines in VS Code’s Debug Console.
Improve Deployment Times for Apex Code
If your deployment times for Apex code are slow, your org might have the
CompileOnDeploy preference set to
true. For details about this preference, see Deploying Apex in the Apex Developer Guide.
For Apex Debugger troubleshooting information, see Apex Interactive Debugger.
For general information about VS Code, see the Visual Studio Code docs.
For troubleshooting information for Salesforce CLI, which powers much of the functionality in Salesforce Extensions for VS Code, see Troubleshoot Salesforce DX in the Salesforce DX Developer Guide.