Setup Salesforce DX IDE environment with Visual Studio Code

My favorite Salesforce IDE MavensMate is no longer being developed and supported, because of app owner Joe’s personal reasons. I’m deeply moved when I read his post (HERE) and realize that devoting to open source needs huge strength and courage, it costs so much personal time other guys can’t see.

So as a Force.com developer, which IDE we should choose instead of MavensMate? I don’t have an answer right now, but Joe recommended the IDE Visual Studio Code, which has an extension like Mavensmate named ForceCode and a Salesforce’s official Visual Studio Code plugin for using Salesforce DX, in this post, I want to share how to setup VS Code for Force.com development.

1. Installing Visual Studio Code

Download Visual Studio Code and install VS Code from below:

2. Installing ForceCode Extensions for VS Code

Open extension manager by clicking extension sidebar or pressing ⇧+⌘+X Search “ForceCode” and install it.

3. New Salesforce Project

Create a folder “YOUR_PROJECT” in local and drop to Visual Studio Code window.

4. Retrieving Metadata from Salesforce

Open Command Palette (⇧+⌘+P) and type “force”, then choose Refresh from server menu. Type in username and password of your Salesforce org. Choose Salesforce org type, Production / Developer or Sandbox. Choose Yes to automatically deploy metadata to Salesforce on save file. Choose Retrieve by package.xml if you already have a “package.xml” file like below, if not, run Get All Files from org, retrieving all metadata may cost a lot of time.

package.xml

Now you can refresh, edit and deploy metadata as below :

5. Running Salesforce DX in VS Code

If you already have a Dev Hub and installed Salesforce DX in local, you can also run Salesforce DX in VS Code with “Salesforce Extensions for VS Code”. Reference this post 《Works with Salesforce Developer Experience (DX)》 to learn about basic usage of Salesforce DX.

1. Installing Salesforce Extensions for VS Code

Install “Salesforce Extensions for VS Code” extension as below:

2. New Salesforce DX Project

Create a folder “SFDX_Project” and new a file “sfdx-project.json” as below:

Drop folder to VS Code window and open Command Palette (⇧+⌘+P), type “SFDX” and choose Authorize a Dev Hub menu. You can also run sfdx force commands on VS Code TERMINAL console as below: That’s all. Salesforce Extension for VS Code provides almost command menu type but not a friendly GUI interface to developers, be honest I still don’t really used to run Salesforce DX command on VS Code though, I’ll share more about Salesforce DX development environment in next posts.

Enjoy it!

Related Post

Pipeline for Salesforce – Be less busy, less... Overview Pipeline is a metadata deploy app for Salesforce, supports: ・Quickly making Changeset from Excel/CSV, in 10 seconds or less! (Coming soon) ・No dependencies on Salesforce Org, deploying metadata between different organizations. ・Deploying metadata base on git flow, pull from Github/B...
Works with Salesforce Developer Experience (DX) Salesforce Developer Experience (DX) will be released from Winter 18, which is a really exciting news I heard from SWTT (2017) , I'll share you how to work with Salesforce DX in this post, so far it still can be only usded in Dev Hub Trial Org though. Download & Install Salesforce DX CLI First, ...
Setup an awesome Salesforce developer environment ... Why Sublime Text 3 ? I've been working with Force.com for about 2 years, and always using Eclipse+Force.com IDE(See here, Eclipse Force.com IDE Installation)as my development environment. I don't think it is really difficult to use, but it could be more friendly. For example: 1. It doesn't suppo...
Using Custom Metadata Types and Custom Settings in... Custom Metadata is one of the new features that released at Summer'15 of Salesforce, which is customizable, deployable, packageable, and upgradeable application metadata, and it supports the following custom field types.   • Checkbox   • Date   • Date and Time  ...