Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

msrivastav13/DX-Code-Companion

Repository files navigation

SalesforceDX Code Companion

Logo

Version Installs Downloads Ratings

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 ability to save Apex Classes,Apex Triggers, Visualforce, AuraBundles, Lightning Web Component Bundles(under preview) and ApexComponents 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 with 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 .

  1. Install SalesforceDX CLI from https://developer.salesforce.com/tools/sfdxcli based on your operating system.
  2. Install mo-dx-plugin using the command sfdx plugins:install mo-dx-plugin.Note if you have already then make sure to update to latest always using sfdx plugins:update
  3. VScode version 1.30 and beyond
  4. Salesforce official plugin provides great syntax and language support.Highly recommend to install (https://marketplace.visualstudio.com/items?itemName=salesforce.salesforcedx-vscode)
  5. You have project workspace set up and have sfdx-project.json file in the root folder and you have ran sfdx force:auth:web:login for project folder and authorized your org with Salesforce CLI.
  6. Extension activation is shown in footer with a rocket symbol. Once extension is active authorize the project if you havent and enjoy faster deploys

Features

  1. Retrieve Source in DX Source format from Managed/Unmamaged package/ChangeSets

    From 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 Unmanaged/Managed Package In DX Format

  2. Retrieve Source from Managed/Unmamaged package/Changesets in traditional metadata format

    From 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.

    Retrieve Source From Unmanaged/Managed Package In DX Format

  3. Save Apex Class,Apex Trigger,Visualforce Page and Visualforce Component To Salesforce Org

    Save Apex

    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"

  4. Save Lightning Components (Both aura and LWC) To Salesforce Org

    If you disable auto save feature you can also Right click on the File and click "Save To Salesforce"

    Save AuraBundle Files

    Save LWC (Available in Spring 19 pre-release orgs)

    Save LWC Bundle Files

  5. 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 .

    Manage conflict

    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

    Manage conflict

  6. Smart Navigations to VF page preview ,Lighnting App Builder Page ,Salesforce Lightning Design System Website ,Salesforce MetadataCoverage Report and Component Library URL

    Screenshot shows how one can find these smart navigation

    Navigations

    Display Status of Save and Success

    1. When Saving files to Salesforce Status of Success or Failure is always displayed on the Terminal .
    2. Extension relies on Terminal API and hence to see any errors and progress keep the Terminal On.

    Below screenshot shows how the errors are logged

    See Errors on Terminal

Video Recordings of all features

https://www.youtube.com/playlist?list=PLDFd1LjbN883y5IlMuU8BCyGhRO-VMuw9

Issue Reporting

You can join the slack channel for any assistance here.

If you find any issues feel free to log it on the github page for the project @ https://github.com/msrivastav13/DX-Code-Companion/issues

You can also reach out to me via my twitter @msrivastav13 or via my MVP email handle mohith.shrivastava@salesforcemvps.com

Extension Shortcut Keys

To open command pallete and look for all CCDX Commands use below .

"MACOSX": "cmd+shift+p", "win": "ctrl+shift+p", "linux": "ctrl+shift+p",

Release Notes

0.4.8

1.Update npm libraries to latest. Fixes Security Vulnerabilities

0.4.7

1.Update npm libraries to latest. Fixes Security Vulnerabilities 2.Update mo-dx-plugins using sfdx plugins:update to get latest CLI plugin extension that powers this extension 3.Diff view now respects current UI theme set by user

0.4.6

1.Update npm libraries to latest. Fixes Security Vulnerabilities

0.4.1

1.Update npm libraries to latest. Fixes Security Vulnerabilities

0.4.0

1.Fix issues listed here

2.Install mo-dx-plugin now from the extension context menu directly if you do not have mo-dx-plugin.

Install mo-dx-plugin for extension

3.Security patch

0.3.9

1.There is a setting provided(dx-code-companion.staticresourcefolder.resourceBundleFoldername) to indicate the resource bundle folder name for single page app development. Default value is "staticresource" but if you prefer to use names like "resourcebundle" or "spa" use the settings to change it 2.A static resource folder has a explorer menu to deploy the folder as static resource bundle

0.3.7

1.Now you can directly edit the static resource file and save to the server.Note that your folders or files should be within folder named "staticresources".If you are building a vf app using vue or React,you can keep your files in folder named staticresources and edit the app and save the file.

0.3.6

1.To manage settings you dont need to edit the settings.json and instead has UI 2.Security path via npm audit

0.3.3

1.Update the sfdx-core to use latest version. 2.Save to salesforce would automatically kick off when vscode opens a folder. Made sure it happens only when user manually tries to save the file 3.Remove support for v1.29.0 vscode. Requires v1.30.0 and above

0.3.0

Fully support changeset driven development (https://trailhead.salesforce.com/en/content/learn/modules/declarative-change-set-development/develop-and-test-changes-locally)

This version requires you to upgrade mo-dx-plugin to 0.2.0 version.

Run sfdx plugins:update to update mo-dx-plugin to latest

With this release,you can use DX Code Companion extension to retrieve source from the changeset created in your sandbox (Assumes you have authorized CLI to sandbox using "SFDX:Authorize and org").Use vscode to edit contents if needed and then deploy to target orgs all from VScode without need to upload the changesets and wait.

  1. To retrieve source from the changeset use the command pallete and select "CCDX:Retrieve Source From Changeset"

Retrieve source from changeset

  1. Provide the changeset name in the text box (Avoid creating changesets with same name in sandbox)

changeset name

  1. Once code components are retrieved , Under changeset directory a sub directory will be created with src folder having all the components .You can edit the source code and also save to the authenticated orgs.

changeset dir structure

  1. Note that the changeset directory has orgs.json to which you can add list of orgs you have authorized salesforce CLI by clicking on the file and using "CCDX:Add Orgs For Changeset Deployment"

Add orgs for depolyments

Select the target org

5.Click on "src" folder for your changeset to deploy them . The interface will ask you to pick orgs from list of orgs you have added in previous step

Deploy changeset

0.2.8

  1. Fixes connection method to use salesforce core library native methods
  2. Adds ability to deploy the src folder for classic metadata directly from explorer menu

Deploy source from src folder

0.2.7

  1. Fixes Manage Conflicts with server is not working for Apex Components and Apex Pages

0.2.6

  1. Fix issue by changing the folder name of content provider to use Capital letter. Seems very weird that not doing this breaks the plugin for chrome-os. The issue is described here (#6)

0.2.5

  1. Adds a new Command Compare With Server to view diff between current local and server file.

  2. By default Manage Conflict is switched off .Turn it on via settings

Manage conflict

  1. Fixed few bugs related to refresh from server on aura components.

0.2.4

  1. Fixes when .xml files would try to save to server .This is not supported at this point and use native salesforce extension to deploy meta.xml files for version changes .

0.2.0

  1. Adds ability to manage conflicts with server copy

  2. Refresh From Server for LWC, Aura files , triggers , vf pages, vf components and classes

  3. Save now compares file with server copy .

  4. A new icon on the footer to indicate SalesforceDX Code Companion is active

  5. Footer now indicates a rocket symbol if extension is active and you can navigate to org clicking on this .

0.1.10

  1. Auto populate package list for selection for Retrieve Options

  2. Retrieve DX Source and metadata options are only available from Command Palette (CMD+ SHIFT + P on MACOSX or CTRL + SHIFT + P on windows)

  3. Previously the Save To Server tried running command on Non Salesforce files .This update fixes this and only saves if the working directory root has sfdx-project.json file.

0.1.8

1.Switch between authenticated orgs using new Switch Org Command .This opens up to switch and deploy the code between orgs using SFDX:Deploy To Org Command

Navigations

2.Fix AutoSave to now not run terminal command if file type is not supported

3.Better naming and Grouping .All Commands now CCDX as the prefix .

4.LWC(Lighnting Web Components) support improved

5.Introduces sfdx-core library in the build opening up lot more existing features to come in next release.

0.1.4

1.Auto Save enabled .You can disable using the autosave property

Auto Save Feature

Use the settings (Select Code > Preferences > Settings) from the gear icon and modify the usersettings to disable the autosave feature as shown below by setting dx-code-companion.autosave.enabled as false .

Auto Save Feature

2.Save LWC Components(Under preview).Upgrade the mo-dx-plugin using sfdx:plugins:update mo-dx-plugin

0.1.3

1.Add support to retrieve metadata using package name in regular metadata format

2.Add some useful link in editor title for vf preview , app builder page ,metadata coverage report and component Library.

0.0.5

  1. Fixes issues for keyboard shortcut

0.0.2

  1. Provides quick save apex,vf,aura bundles to salesforce server
  2. Retrieve Source from Salesforce using DX Source format.
  3. 3X performant than salesforce deploy command for apex,aura and vf files.

For more information and contribution to project visit the below repositories and use issues tab to log any feedback or issues .

Enjoy!