Development Guest posts Interviews Plugins

Salesforce development plugins, part 2 — JetForcer

Today we’re continuing the series of guest posts from the creators of IntelliJ IDEA plugins for Salesforce (or Force.com) developers. The first post covered Illuminated Cloud 2 plugin.

Please meet the 2nd blog post by Michael Shumenko, co-founder of JetForcer.

Deep dive into Salesforce development with JetForcer

Most people have already heard of Salesforce. This company is behind one of the largest and most well-known platforms for CRM solutions. Today, the company has more than an 18% market share and has surpassed even the giants SAP and Oracle.

Every day, Salesforce developers from all around the world integrate across systems, presenting data in the right place and at the right time to fit their customers’ needs. That’s why an IDE (Integrated Development Environment) should be an unparalleled ally for each developer.

This article is a deep overview of JetForcer – a plugin for Force.com development with JetBrains IDEs, that goal is to get rid of tedious development processes and make the job of developing enjoyable.

Let’s take a closer look at what’s so special about JetForcer.

(Please note that all described features work for Lightning, SOQL or Visualforce as well as for Apex)

Power of Refactorings

As Martin Fauler once said, “Refactoring is a disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior”. These techniques are popular in the daily software development process, regardless of the programming language being used.

JetForcer offers a set of powerful refactorings to substantially increase development productivity

Here are a few of them:

– Renaming

1-rename

With rename refactoring, you shouldn’t have to worry about element references. They will be changed automatically in all the places of the entity usage.

– Changing Method Signature

2-change_signature

It will help you to quickly redesign your methods not only by renaming them, but also by modifying the parameter list (adding, reordering, renaming, deleting). Moreover, it makes it possible to change parameter types and default values (that are passed as arguments to the method call).

All usages and overriding method declarations will be updated automatically.

– Extracting Method (Constant, Field, Variable)

3-extract_method

Extracting code to a local variable, constant or method is a simple way to avoid having to copy-paste. Some part of the code (expression or statements) can be moved out and all the duplicated code will be replaced with call the new expression. All the user will be asked is the name of the new member.

A nice trick if you want to forget about the copy-paste action and duplicates in the code.

This is not a full list of all the available refactorings but don’t worry. The ‘Refactor This’ action will always help you find which refactorings can be applied in the current context.

4-refactor_this

Power of Real-Time Error Detection and Quick-Fixes

JetForcer analyzes source code and detects not only syntax but also semantic errors. All the found errors are instantly highlighted in the editor. It not only describes the problem exactly but also suggests quick-fixes. Simply press Alt+Enter and make your choice.

5-quick_fix

Here are just some of the most popular of them:

  • “Create entity from usage” group
    (generates the corresponding symbol based on the usage context)
  • “Change type” group
    (detects incompatible assignments and propose to change one of the assignable types)
  • Implement interface method
    (generate templates for all not implemented methods from interface or abstract class)
  • Cast types
    (detects incompatible assignments and suggest cast type)

Power of Intention Actions and Code generation

Moreover, you may simply redesign or extend your code with the provided ‘intention’ actions or ‘Generate’ action popup. All you need to do is press Alt+Enter or Alt-Insert and choose any action available for the current context.

6-intention_action

Binding a parameter to fields, Introducing a new variable, and generating various code templates is easier than ever before. Just enjoy it.

Power of Code Completion

And last but not the least, for this article, is the editor feature code completion. It helps developers be much faster and more productive.

Following features are available:

  • type-aware completion sorts the suggestion list and shows the most appropriate options on top
  • automatic insertion of paired elements (braces, brackets, quotes etc.)
  • complete current statement (Ctrl+Shift+Enter) action generates necessary tokens (braces, parentheses, semicolons etc.) and places the caret on the position where you can continue typing the next statement.
  • postfix completion helps transform an existing expression into another one based on the postfix you choose. For example the .selfr postfix applied to a sObject name wraps it with an SOQL query.
  • member name completion suggests variables and member names based on the type
  • override or implement methods with completion

… and many other kinds of completion.

7-code_completion

Also, you may want to read the post about the Top 10 features of code completion for Lightning in JetForcer IDE.

Power of Conventional Deploy with VCS-like Approach

The deploy process with JetForcer is powered by ApexVCS – a small integrated VCS, which tracks the difference between the local and server states.

Once changed (edited, created or deleted), a metadata file appears in the Version Control / Local Changes view, so the view will contain just your changed files, which allows you to navigate through them quickly. Then, you may review the differences in the changed files with the side-by-side viewer.

If your org is shared with other developers, you should find ApexVCS conflicts resolving feature useful. After the initial implementation of your feature is deployed, you may prefer to deploy the recently edited files immediately, which is also possible with JetForcer.

8-deploy_apexvcs

You may think of ApexVCS as one of the predecessors of SFDX – consider “sfdx force:source:status” command and the related changes processing.

The Power of Retrospective Debugger, Log Viewer, and Log Manager

In the world of Salesforce, the debug log is a container for all the information and code you need to debug and analyze. But having only information is not enough, no less important is having powerful tools for exploring it.

The following tools are at your disposal:

Log Manager includes:

  • Logs tab with the ability to open and filter existing logs, download new logs from the server, distinguish between new/read/unread logs, and quickly activate expired trace flags or create new ones.
  • Trace Flags tab provides tools for managing Trace Flags and Debug Levels

Log Viewer

  • Viewing the log body as a code execution tree
  • Customizing the font color for tree nodes with certain log events
  • Add some log events to be ignored in execution tree
  • Search text occurrences inside an execution tree
  • Navigate to code sources right from the log viewer just by clicking on an execution node

9-log_viewer

Retrospective Debugger
step-by-step execution with Debug tool window

10-retrospective_debugger

DX Support

Salesforce DX is a new way to build Salesforce applications. It introduces a new type of environment: Scratch orgs. JetForcer has the dedicated SFDX view, which provides functionality for manipulating them.

All the functionality available for a conventional org also available for DX orgs (including Execute Anonymous, Runnings Tests, Exploring Debug Logs etc.).

11-dx_support

Others Features:

Also JetForcer provides a SOQL Editor, Test Framework for running Apex tests, Code Coverage Inspector and much more. Read about them on the plugin website.

Conclusion

I hope this article helps you to better understand how to develop with JetForcer, what the benefits of it are for developers and how much of your time it can save.

Contacts

If you find it interesting, you may download a free 30-day trial version from the official website.
Contacts: To submit feature requests or just report bugs, use the plugin’s issue tracker.
A more detailed tutorial on how to use the plugin along with its features description can be found on the plugin’s site.
Make sure you follow @JetForcer on Twitter to be notified about updates, features, new releases and interesting facts about the JetForcer plugin.

image description

Discover more