Warning: Illegal string offset 'ssb_og_tags' in /var/www/www.xgeek.net/html/wp-content/plugins/simple-social-buttons/simple-social-buttons.php on line 1466

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!