How to Switch to salesforcedx-vscode Without Anybody Noticing

Charlie Jonas

Or at least without breaking their $h%T (maybe)

When I first started working on the Salesforce platform, Mavensmate + Sublime was by far the best “IDE” out there. Unfortunately, once Salesforce announced DX, the primary maintainer (Joe Ferraro), decided end development & support.

Fast forward almost 2 years AND Salesforce is close to delivering an acceptable replacement via their vscode extension. It’s definitely better in some ways, and arguably still worse in others. I finally decided that the pros outweigh the cons and have made the switch.

The purpose of this guide is to walk you through setting up vscode-salesforce on a “pre-sfdx” project without needing to change your file structure*.

This is important when you have other developers would would like to continue to work in Mavensmate (or other IDE) and you don’t want to force them to make the transition with you.

If you can talk everyone on your team into using an IDE that support the new “sfdx project” format, then I recommend you transition your project based on this guide instead.

This is NOT a guide on how to switch to scratch orgs.

*This will not work with some metadata types (such as CustomObject), because salesforce has changed the project format.

Transition Steps

  1. Open/Clone down your project from source control (hopefully you are using source control…)
  2. In the project root, create a new sfdx-project.json file with the following contents:

The key here is path: "src" . If your project stores its source in some other location, then update this line.

3. Create a file /manifest/package.xml . Copy the contents of src/package.xml here. It seems like you should be able to just refresh from src/package.xml but for some reason it doesn’t work 🤷‍♂

4. Add a development/sandbox org by running SFDX: Authorize an Org. Set it as the default by running SFDX: Set a Default Org

5. Enable “Deploy on Save” by running Preferences: Open User Settings and adding ”salesforcedx-vscode-core.push-or-deploy-on-save.enabled”: true,

To Refresh Metadata

Right click on /manifest/package.xml and select Retrieve Source From Org .

Any files that are already in your src folder will be updated. If any new files are found, they will be place into the main/default folder (unfortunately this cannot be configured). Simply move them to src and on the next refresh they will be updated.

One caveat is if you refresh an individual file, it AWALYS ends up in main/default , even if it already exists in your src folder (github issue).

To Promote Metadata

The Salesforce extension doesn’t yet have any real deployment capabilities. Because of this, I’ve setup a series of custom vscode tasks to help with metadata migrations:

To use these tasks, create a folder in the root of the project called deploy and add a package.xml file.

Whenever need to migrate something, update this package.xml then run Tasks: Run Task -> Retrieve followed by Tasks: Run Task -> Deploy. This can be expanded on in a number of ways, but this basic flow has been working well for me.

This definitely is a big step back from the nice “Deploy” GUI that MavensMate (and other IDE’s) provides, but it’s better than nothing…

But should you transition?


  • Unit Test Runner
  • Great Log replay debugger
  • Best LWC + Aura Support
  • Should continue to get better

Pain Points

  1. Won’t be backwards compatible with all metadata pre-sfdx project
  2. Poor Apex Code Complete
  3. No UI based deployment
  4. Refresh file bugs
  5. No “Clean Project” ability. Refresh does not removed deleted files

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade