Salesforce extension for Visual Studio Code
Visual Studio Code is a code editor with powerful developer tooling, like IntelliSense code completion and debugging.Visual Studio Code is a product from Microsoft. which is free and Open Source that supports macOS, Linux and Windows. Visual Studio Code for Salesforce DX is an extension bundle which provides feature to work on Scratch Orgs, Apex, Lightning components and Visualforce.
In this tutorial, we will learn how to Install Visual Studio code and we Install Salesforce extension for Visual Studio code. Let us learn how to make it.
Step 1 : Downloading Visual Studio Code
Visual Studio Code is used as an IDE to explore Lightning components and other features. Download Visual Studio Code at code.visualstudio.com.
Select the operating system to which that you wish to download. Install Visual Studio Code in your local system.
Step2 : Installing Salesforce extension for Visual Studio Code.
After installing Salesforce extension for Visual Studio Code, Open VSC and search for “Visual Studio Code extension for DX” as shown below.
Note: Before you set up Salesforce extension for Visual Studio Code make sure you install Salesforce CLI , Salesforce DX project is created and install latest version of the Java from standard edition development kit.
Using visual studio code for salesforce
Once Visual Studio Code for Salesforce DX extension installed, open your Salesforce DX project that has sfdx-project.json as root as shown below.
Open the project (sfdx-project.json as root) in Visual Studio Code.
Now our project is added successfully. Let us try to execute some SFDX commands using Visual Studio Code.
Executing SFDX commands using Visual Studio Code.
In this example, we will create Apex class using Visual Studio Code. To Create an Apex class navigate to command palette as shown below.
Once we type sfdx in the command palette, we notice list of Salesforce DX commands can be executes using Visual Studio Code.
- Select SFDX: Create Apex Class.
- Now enter Apex class name (tutorialkart).
- Enter or select directory. Choose any one directory from the list and press Enter to confirm.
- Our Apex class has created successfully as shown below