Feedback
TWS Blog

Apex Code Completion and Code Assistance in Development

The Welkin Suite
Posted by username
May 16, 2017 493

Finally, the long-awaited improvements to the Code Assistance and Code Completion features are so close to being released that we felt it was time to shed some light on what you should expect to get next Monday, May 22nd. In short - we've completely rewritten it... For the 2nd time (smile)

Apex Code Assistance improvements highlighted

As you might have guessed, a complete rewrite required a vast amount of work and thought from the team, and it has also resulted in a huge amount of changes - some of the changes will be very significant, and you'll spot them immediately, while others won't be so obvious, but not significantly less helpful. So let's go ahead, and walk you through some of the major changes which we have been working on.

Code Completion in Triggers and Anonymous Apex

While triggers usually do not contain a lot of code, for instance if you're using Trigger Handler or some other similar patterns, it is still very important to have reliable and consistent code completion, even when you are writing just a couple lines of Apex for them.

However, at the same time, Anonymous Apex is an absolutely different kind of a beast - we are normally using it to test some different approaches or solutions, to "play" with the code, to debug something in a "manual mode", or just to execute some other method or job. Simply speaking, it is mostly being used for a trial and error approach.

So what we did was we're finally filling this gap, and soon The Welkin Suite will provide to you the same great (read below why it'll be great) code completion for regular Apex classes, Apex triggers, and Anonymous Apex.

Improved standard Apex members, sObjects and their fields database

From our point of view, the ideal Code Completion should be "aggressive" enough to allow you to type only 1-2 symbols and hit "enter", dot, etc., and it should be doing this reliably all the time. You are probably already to ask the rhetorical question, "But what is the benefit of "aggressive" code completion if it knows only 30-50-80% of the standard Apex namespaces and classes, or sObjects and their fields?" And You're right to ask this, and the answer would be-- not as much as everyone would like to get.

Prior to the upcoming update, our database was not large enough, and our IDE was missing some of the important information, therefore it was sometimes annoying - especially when it was inserting something that you didn't expect. We had to change our approach to collecting the data, so we will not only be preparing a database beforehand that is based on the Apex documentation (we are doing this still, and doing better at it), but also we are dynamically retrieving lots of handy information from the Org itself, when creating a project.

New Apex methods Signature Helper

Apex Code Completion changes brakedown

The mockup above is pretty self-descriptive, so I will simply list some of the changes to the methods signature helper that we will implement:

  • Displaying overloads hints and switching between different overloads with 'Up' and 'Down' keys
  • Highlighting the current parameter that you are entering right now (however, we still recommend for our users to use PMD to get rid of their methods that have an excessive number of parameters)
  • Displaying an ApexDoc hint for the current parameter that you're entering right now

We are sure that these changes will be very helpful for both 'Senior' developers, who are writing very complex applications, and for newcomers, who are sorting out the capabilities of Apex and the application which they are working on

Proper generics and nested types handling

I guess that I wouldn't be lying if I would say that Salesforce developers are using Lists and Maps all the time. This means that the correct handling of all standard Apex types that support generics is very important, if not critical. What I mean by 'correct' here is that the code completion will suggest to you the List members for the List variable and along with that, the specific type members for those specific list items.

Also, as it might be clear from the heading above, all the nested types inside your classes should be processed and suggested in the completions list in the applicable scopes of visibility.

I know this doesn't sound like a killer feature, and I would agree. But it does add so much more comfort and confidence in what the IDE suggests for you to type.

And many, many other changes...

This is just a highlight of what we have been working on in the scope of the Code Assistance features, so you can now be get prepared for the 22nd of May to be among the first to update to the new version of The Welkin Suite, and try out all these changes by yourself!

Please share with us what do you think about these changes, and what else you'd like to see in the Apex Editor!

Apex Code Completion in The Welkin Suite - development plans
Apex Code Completion in The Welkin Suite - highlights

Your comment may be the first

    Please log in to post a comment