The first time I’ve heard about Visual Studio Code was the last year at TrailheaDX in San Francisco. I was a Sublime Text 3 addicted and I didn’t believe Visual Studio Code could offer something better. I was wrong!
I don’t want to list the difference between the two tools, but I think it could be better if I share with you the key steps to configure Visual Studio. I will have time to discover the great features on your own.
This post aims at being a guide to install, configure and use the most important commands of Visual Studio Code.
Install and configure Visual Studio Code
[Install VSC] – First of all, you need to download the IDE from the following link. [Install Mavensmate] – Once you have installed it, download Mavensmate. The program is no more maintained as announced by joeferraro, but you can still download the last version of the program from the following link. I’ve downloaded the last beta version and I having any problems so far.
Once you have installed both the programs you can start configuring Visual Studio Code. It is a packet manager editor, like Sublime Text 3, so you just need to install some extensions.
Click on the Extensions button to search and install the following packets:
- Salesforce Extensions for VS Code
We can now configure Mavensmate.
Launch the program and open an existing project or create a new one. You just need to click on “New Project” and connect to the Sandbox of interest.
Click on settings and set the path of your VS Code editor program.
We are almost at the end. If you properly installed and configured VS Code, you are now able to open your project directly in the editor. Just press the screen icon an click on the option ‘Open in Vscode’.
You can now refresh, modify, compile and save the code from VS Code. Every time you save a class or a metadata, Mavensmate will automatically deploy it in your Sandbox.
The most important commands for VS Code
Well, now you have a Ferrari, but let’s see together how to drive it.There are two fundamental shortcuts you have to keep in mind:
- Ctrl + P: search files in your project. Very useful for big projects
- Ctrl + Shift + P: to run VS Code commands
Some of the commands you will mostly use are:
- Mavensmate: Run Apex Tests -> to run tests from VS Studio Code
- Mavensmate: New Apex Class -> to create new apex classes from Mavensmate and sync VS Code with the Sandbox
- Mavensmate: New Lightning Component -> to create a new Lightning Component
Of course, there are a lot of other commands you may use, just enjoy to find them.
VS Code is the Salesforce official alternative to the most famous IDE like Eclipse and Sublime Text 3. You can synchronize the IDE with Salesforce thanks to Mavensmate, but there are a plenty of alternatives (i.e. ForceCode).
One of the main advantages of VS Code is a native integration with SalesforceDX, thanks to an integrated CLI (installable through editor’s extensions).
- LTC Address: La5f6W1rPr5VHFGCrCmPJ3sSa2AiwKZJbU
- BTC Address: 1FG1j42MUze8jiW7JbgNaUMZxZeu7M1b4f
- Ripple Address: rPVMhWBsfF9iMXYj3aAzJVkPDTFNSyWdKy Tag: 562614972
- ETH Address: 0x0940958167ca9cbd6409999957a011be7907d904