Troubleshooting Common Issues

Troubleshooting Common Issues

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.

  1. Make sure that the root directory you have open in VS Code contains an sfdx-project.json file. If you haven’t set up a Salesforce DX project, check out Project Setup in the Salesforce DX Developer Guide.
  2. 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:

  1. Search for Edit the system environment variables. Windows Search

  2. In System Properties, click Environment Variables. System Properties

  3. Under User Variables, double-click Path . User Variables

  4. 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 Path View

  5. Click OK.

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:

  1. Opened a Salesforce DX project that has a valid sfdx-project.json file.
  2. Opened the Salesforce DX project as a top-level folder.
  3. 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.

Other Resources

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.