How to Setup Visual Studio Code for Salesforce Development

In this post we will look into detailed steps to setup Visual Studio Code as IDE for Salesforce code development.

In the recent past, we have observed that Visual Studio Code (VS Code) is picking up popularity among open source IDEs for code development across multiple programming languages. JavaScript-based frameworks, Python-based application development, Salesforce Apex Code development, HTML, CSS based Front End development and so on are the most popular choices working with VS Code. This powerful behavior of supporting multiple platforms resides in the ability to adopt Plugins & Extension Packs that support the most popular programming languages & frameworks, and I believe Visual Studio Code has does a brilliant job so far.

In this post, we will look into detailed steps to setup Visual Studio Code as IDE for Salesforce code development. Here is the quick list of the components that we would be working through in the following sections-

  • Install & Configure Visual Studio Code
  • Install & Configure Salesforce CLI
  • Install & Configure Salesforce Extension Pack
  • Create Test Salesforce Project
  • Authorize Salesforce Org

We will discuss the individual configuration for each of the moving parts contributing to this setup in the upcoming steps-

Install & Configure Visual Studio Code

  • Click on “Download for Windows”
  • Save the setup file
  • Open the setup file by right click > Open. Please make sure you don’t use the “Run as Administrator” option since VS Code cannot be installed with Admin privileges as suggested by the following alert message.
  • Accept the License Terms and click Next
  • Click Next
  • Click Next
  • Make sure “Add To Path” is checked and click Next
  • Click Install
  • Wait till the setup completes the installation, which should be really a quick install
  • Click Finish & Launch VS Code to make sure installation works just fine

Install & Configure Salesforce CLI

  • Click “Download for Windows” depending on windows version you are running on
  • Save the CLI setup file
  • Open the setup file by right click > Open
  • Keep the defaults and Click Next
  • Keep the defaults and click Install
  • Wait till setup completes the installation, which should be really a quick install
  • Click Close to complete the installation

Install & Configure Salesforce Extension Pack

  • Launch VS Code
  • On the left most menu panel, Click Extensions Icon of press “Ctrl + Shift + X”
  • Search for “Salesforce Extension Pack”
  • Install Salesforce Extension Pack by clicking “Install” and wait till installation completes
  • Launch a new terminal by going to Terminal Menu > New Terminal or press “Ctrl + Shift + `”
  • Now we have to validate the installation of Salesforce CLI by typing “SFDX” in the new terminal. If we get the following similar outcome then we can ensure a successful installation.

Create Test Salesforce Project

  • Launch VS Code
  • Press “Ctrl + Shift + P” to see all available commands from all installed plugins & extensions
  • Search for “SFDX: Create Project with Manifest” and select it
  • Select project template as “Standard” or whatever suits you the best
  • Enter the desired name of the Project, whatever suits you
  • Select the folder location to save this project on the disk
  • And sure enough, we will get our new Salesforce project created with the manifest file

Authorize Salesforce Org

  • Launch VS Code
  • Press “Ctrl + Shift + P” to see all available commands from all installed plugins & extensions
  • Search for “SFDX: Authorize an Org” and select it
  • Select for “Org Url” Template, I will go by project default for this demo
  • Enter the Org Alias to recognize you Org by an alias, I have specified “SFOrg” as an alias for this demo
  • This process with direct you to the Salesforce Login Page, where you can specify the login credential for your Org (no matter Prod or Sandbox). Enter your credentials
  • Once successfully login to the Salesforce Org. visit the VS Code again and sure enough, we get the notifications to successfully authorize the Org.

Hope you enjoyed this article. Please leave your comments to let me know how you do like the content and how you do find it helpful to learn the topic.