SalesforceDX Code Companion
Note that this is not official from Salesforce. I created this extension to help my own development workflow for building Salesforce apps. This extension supplements Salesforce Official Extension Pack with features like faster save of apex, lwc and vf pages. You can use this to also retrieve package metadata from salesforce orgs in both traditional metadata and SalesforceDX formats. Also supports managing conflicts between salesforce files and salesforce org
Provides the ability to save Apex Classes, Apex Triggers, Visualforce, AuraBundles, Lightning Web Component Bundles(under preview) and Apex Components to Salesforce Org at blazing speed without source tracking. Also enables retrieving code from the salesforce unmanaged package/changesets in both DX and NonDX source formats. You can also switch between authenticated orgs easily with CCDX: Switch Command. This extension requires users to have SalesforceDX CLI and also mo-dx-plugin(run sfdx plugins:install mo-dx-plugin) for SalesforceDX CLI.This Extension works with both scratch orgs and Non-scratch orgs.
It is highly recommended to use Salesforce Extension Pack to get all the other good things salesforce official extension offers (https://marketplace.visualstudio.com/items?itemName=salesforce.salesforcedx-vscode) .
Requirements
This vscode extension works only once you have installed Salesforce CLI and a mo-dx-plugin(run sfdx plugins:install mo-dx-plugin on your terminal) that has api for all the commands this extension leverages.
- Install SalesforceDX CLI from https://developer.salesforce.com/tools/sfdxcli based on your operating system.
- Install mo-dx-plugin using the command
sfdx plugins:install mo-dx-plugin
.Note if you have already then make sure to update to the latest always usingsfdx plugins:update
- VScode version 1.30 and beyond
- Salesforce official plugin provides great syntax and language support. Highly recommend installing (https://marketplace.visualstudio.com/items?itemName=salesforce.salesforcedx-vscode)
- You have project workspace set up and have sfdx-project.json file in the root folder and you have run sfdx force:auth:web:login for project folder and authorized your org with Salesforce CLI.
- Extension activation is shown in the footer with a rocket symbol. Once the extension is active authorize the project if you haven't and enjoy faster deploys
Features
- Retrieve Source in DX Source format from Managed/Unmamaged package/ChangeSetsFrom the command palette menu select "Retrieve DX Source From Package" . Provide the name of the managed/unmanaged package in input box and press enter .This is the recommended source format.The source is in the format specified here (https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_source_file_format.htm)You will notice that package.xml is autogenerated in the manifest directory and source code of the package is retrieved in DX source format in force-app folder.
- Retrieve Source from Managed/Unmamaged package/Changesets in traditional metadata formatFrom the command palette menu select "Retrieve Source From Package". Provide the name of the managed/unmanaged package and press enter .Projects still not moved to the DX format can benefit from this .You will notice that package.xml is autogenerated and source code of the package is retrieved in src folder. Create a folder src if your project does not have one.
- Save Apex Class,Apex Trigger,Visualforce Page and Visualforce Component To Salesforce Org
By default autosave is enabled .Hence when you save file the extension will try to save the file to salesforce you have logged in by default.If you disable auto save feature you can also Right click on the File and click "Save To Salesforce Menu" - Save Lightning Components (Both aura and LWC) To Salesforce OrgIf you disable auto save feature you can also Right click on the File and click "Save To Salesforce"
Save LWC (Available in Spring 19 pre-release orgs) - Manage Conflicts with server This feature is turned off by default .It compares server copy with the local copy before save and if a difference is found you will see a prompt in a diff editor with options to either overwrite or accept change from server. Also you can manually resolve the conflicts and push changes .
If you wish to turn this feature (If you have VCS for your project and do not develop in team) for faster save you can do so by disabling Manageconflict settings found in settings for extension - Smart Navigations to VF page preview ,Lighnting App Builder Page ,Salesforce Lightning Design System Website ,Salesforce MetadataCoverage Report and Component Library URL
Display Status of Save and Success
- When Saving files to Salesforce Status of Success or Failure is always displayed on the Terminal.
- The extension relies on Terminal API and hence to see any errors and progress keep the Terminal On.
Popular Salesforce Apps and Tools
-
This LWC is used to see all the Standard as well as Custom Object with all of their Record Types & Child Relationships.FreeCode1,094 Views
-
-
This application scans all the (non-packaged) Apex Classes in your Org to builds a table of where each property, variable and method is used. Useful for cleaning up unused code.FreeTool1,276 Views