Feedback
TWS Blog

Blaze R1 for Mac with Lightning Previewer, PMD Apex, new Code Assistance

The Welkin Suite
Release
Posted by username
Jun 12, 2017 791

We are ready to start this summer off by presenting to you some new abilities of The Welkin Suite IDE for Mac, so please meet the newest updated version of the IDE - Blaze R1, and be ready to be impressed with its great functionalities, which will help you to improve you working process on Apex and Lightning. We did a great job tackling the amount of work that was related to the refreshing of, or even better said, the rewriting of the Code Assistance functionality, and the changes that we've made have solved a lot of issues, and we really feel that we are now providing you with a more powerful tool for all of your work. Also, the implemented built-in PMD support, in the IDE, will help you to analyze your Apex code, and keep it much clear and much easier to maintain thought the life of your project. The new Lightning Components and Applications Previewer not only looks incredible, but it will save greatly your time by letting you preview all of your changes in just seconds directly from The Welkin Suite IDE. Plus, now you won't miss any really useful options or new features in the IDE, because now you can use our new Getting Started guide that has tons of tips for exploring The Welkin Suite.The Welkin Suite for Mac Blaze R1The Welkin Suite for Mac Blaze R1

Lightning Components and Application Previewer

The newest version of The Welkin Suite for Mac has new abilities for your Lightning development!

As Salesforce's Lightning framework is one of its newer endeavors, there is always a growing list of tweaks that keep just making it better and better. Due to this, more and more organizations are switching to this framework, and as a result, all of those who work with the Salesforce Platform find themselves working hard to keep up-to-date with the continually growing power of Lightning, as they are switching their Visualforce solutions to Lightning, and as they are starting now most of their new projects with it. And as what people in salesforce do, so must our IDE! 

Beginning from the Blaze R1 version of The Welkin Suite IDE for Mac, you have a convenient possibility to track all the changes, which you make, in your Lightning Components and Applications, directly from the IDE, using our new Previewer. It is built-in in the Lightning editor for all Lightning bundles. From now on, you don't need to switch to a browser, or reload a page, because now, after each time you've updated something, the IDE will show you all of the changes that were made.

Built-in previewer for Lightning Components

The Welkin Suite's Lightning Previewer is available for all of your TWS projects that are related to the Salesforce Organizations, and that have a custom domain. The nice part about this is that you don't need to specify anything about this during the project's creation in the IDE, just check and see if this is active on your Org - in TWS you can just enter your usual set of credentials, and select the needed environment type.

As we've already mentioned, the Lightning Previewer is available for your use with Components and Applications Bundles, and they will now be opened for you automatically in a combined editor, when you open any the Bundle's members file. Events, Tokens, and Interfaces files will be displayed in the usual code editor, because they don't need any options of previewing. And for the previewer itself, in the appropriate bundles, is present in the upper part of the combined editor.

In addition to this, when you open an Application Bundle in The Welkin Suite IDE, you will see a preview of this application automatically. Plus, you have a possibility to specify the necessary URL parameters, if this is needed in the toolbar of the Lightning previewer.

Built-in previewer for Lightning Application

There are also some additional settings for the previewing of your Components Bundles. When you open a Components Bundle, you can select exactly which Lightning Application should be being used to preview this Component. There is an option to select the Application from the drop-down menu, where you will see a list of the Applications which are present in your TWS project. After selecting the needed application, you can specify any additional URL parameters in the appropriate field, in the toolbar of the previewer. Also, we would like to note that when you open the same Component sBundle, the next time during a TWS session, the same selected application will be opened automatically.

Also, there are two more options in the Lightning Previewer for Components and Applications:

  • Refresh button: it is located on the left side of the previewer's toolbar, and by using it, you can get the updates from your related Salesforce Org without any editing and/or building of your Lightning files in the IDE. For example, this is great when you are getting updated information that is loaded to an Application on a Salesforce Org, or when getting changes from other developers.
  • Open in browser: you can find it on the right side of the toolbar, and with this, you can open a preview for your Lightning Application, in your default browser directly from the IDE.

So, when you make any changes in your Lightning files and it is time to build them, the previewer is automatically reloaded, and you can see all of your updates in the same window, without any additional actions.

These are not all of the benefits of the Lightning Previewer. Another one of them, which is really important and useful, is now you can see all the members of any opened Bundle in the same editor, under the previewer. This means that beginning from The Welkin Suite Blaze R1, you don't need to switch between different tabs to check the preview - it is always available for you no matter which bundle file you are working with at the moment. Also, we want to draw your attention that if there are some unsaved changes in any Lightning member - you will see an appropriate yellow marker-line near these changes, and each file which was modified, and wasn't yet saved, will contain the circle icon near its name on the tab. So when you are working with any file - you can see which files were edited also.

New Code Assistance

Finally, the new Code Assistance and Code Completion hits the Mac version of The Welkin Suite, so writing the code now becomes more comfortable and requires less of an encyclopedic knowledge from you. It's tricky to squeeze a full description of the huge amount of work we have done into just couple paragraphs, so we'll just highlight the most important and noticeable changes to you. And we'll start our description with the core changes and improvements that will significantly impact everything, that is related to Apex in The Welkin Suite.

First and one of the most important changes in the first Blaze release is the full Code Completion support in all Apex files within your project - classes, triggers and anonymous apex. This became possible because of the changes that were made in our Apex grammar, which now properly recognizes triggers, and anonymous apex blocks. We believe that this change will help you finding new ideas for your code, and with testing and troubleshooting the existing codebase as well as performing some small but handy actions like inserting the needed data, or scheduling jobs faster than it was done before.

However, this is not the only positive outcome of the changes in the Apex grammar, as we've also almost rebuilt everything else from scratch - lexer, parser, suggestions logic, etc. Let's go through the other benefits of this:

  • Because of the major updates to the grammar, we have covered a lot of gaps in the code analysis, so the Code Completion is now much smarter than it was before. From now on you won't get irrelevant suggestions in the completion list - no more instance members when working with static class, no more private members from outside the class, and local variables are visible (first of all - they are visible! now in try..catch blocks, regular for loops, etc.) only according to their scope of visibility and so on. This also means that there's almost no chances that your code won't compile after you've inserted some suggestion from the completions list.
    Apex local variables completion
  • If you were previously experiencing any issues with the functionality, that is related to the code analysis - this was due to the fact that our lexer or parser was unable to properly understand your code, because of some constructions that it was not expecting. As a part of this release preparation, we have tested all publicly available code, in addition to tens of megabytes of our own Apex code, in order to ensure that you won't be faced with such issues anymore.
  • Another related change is the proper detection of overloaded methods - you don't need to be guessing if there're any overloads that can fit your needs, and you don't need to search through the Salesforce documentation. You will see all the available overloads in the completions list with information about parameters and return types.
  • Inner classes are not used every day in Salesforce development, however they are still very common, so we have enhanced our support for them, and you will only get proper completions when writing or using them.
  • If inner classes are not the most-commonly-used structure in Apex, we bet that Lists, Maps and Sets are 1st place, and they are the only generics supported by Salesforce. In the Blaze R1 version of the IDE, you will get full support of the generic types, thus when you'll look for the members of the list - you'll only get them, and when you'll look for members of the list item - you'll get them, but not the 'List' members.
    Completion Apex generins in the IDE
  • Taking into account the significant growth of the complexity of all underlying layers - you'd might expect to suffer from some lags and performance of the Apex editor, right? This is not the case now - we've also done a lot of performance improvements, so now the Apex editor, in general, works much faster than it was working before. For example 20k lines of code in a single file won't cause any additional delays or performance issues!

If we'd go one level higher in the Code Assistance architecture, we'll also find a lot of great improvements, so just to name a few:

  • We have updated our completions database for all standard namespaces and classes that Salesforce provides us.
  • Additionally we've included Salesforce's documentation for many standard classes and their members, so you won't need to switch to the browser for at least this documentation.
  • Another completions list improvement is that we are performing a one-time dynamic retrieval of the data about your orgranization's sObjects and fields

These are some of the most important changes from our point of view in the Code Assistance in the Blaze R1, however there's a whole lot of other fixes, changes, and improvements. We are sure that all of them will help you when developing your great applications for Salesforce!

The built-in PMD support

Salesforce always requires an "A" Game approach, in regards to to the quality of code that is written, because of always having to deal with the rigorous performance requirements that is related to work with Apex, and also because of needing to write code that is easy to maintain over the long run. This is why the use of tools for code analysis is climbing in Salesforce, as developers feel a need to help them install and maintain a set of discipline, most often by defining a set of must-follow rules that cannot be broken our bent, for them and the team. And now this can be managed from The Welkin Suite IDE!

PMD analyzes some Apex code according to different predefined rules, for example, the presence of asserts in a class file, SOQL in loops, excessive class length, etc. All of these rules are separated into several thematic categories for convenient navigation between them. The categories of PMD rules, according to PMD's specification, are the following:

  • ApexUnit - rules, that are dealing with potential problems in Apex tests
  • Braces - rules, that are related to correct usage and placement of braces
  • Complexity - rules, that are checking against potential code size or complexity issues
  • Performance - rules, that are checking for violations of good practices of performance-relations
  • Security - rules, that are scanning for potential security violations in Apex
  • Style - general styling and code naming rules

 PMD Apex Ruleset Configurator

To manage the execution of all the PMD rules that are necessary for you, you can use a set of them in just one ruleset. By doing it this way, you have an ability to include all the needed options, configure the settings, and set the appropriate priorities, and force the checking of all that is necessary for you, in just one clean operation. The Welkin Suite IDE provides you with a Configurator for PMD Apex Rulesets, for all these actions, so you will not be needing to switch to any xml files, look for an additional documentation, or open any other tool - everything is present directly in the IDE: all the descriptions, possibilities to set up all the settings and priorities, and all necessary information is linked here also to manage your rulesets.

The built-in ruleset manager is available for you in the IDE by the following way: menu Tools → PMD Apex Ruleset Configurator. Right here you can create a new, or load an already existing ruleset xml files, even if these ruleset files were created outside the IDE.

In the case when you are just starting out for the first time with PMD and its benefits, the most easy and convenient way is to work with all of this is to use the 'ready-made' templates that are available for you in The Welkin Suite Blaze, or you can use on of these as a base for your own customized one. To do this, follow the New → New From Template option. So let's show you these two temples:

  • Code Climate Template, which is configured by the development team from Code Climate service; this template include a set of PMD rules which are most commonly used for Salesforce development;
  • The Welkin Suite Template, which we have set up based on our experiences, and also in a bit less obtrusive way, so this should be good for you if you are working on projects where PMD has not been used before. The template that is provided by our team, in general, is configured according to the parameters and properties that could help you to improve your codebase step-by-step, by adjusting only the 'Error threshold' in The Welkin Suite - we will describe this below.

In another cases, you can load your existing ruleset file into the IDE (using the 'Open' button) or create a new one - click New → New Empty Ruleset in the PMD Apex Ruleset Configurator.

For any new or existing ruleset file, you have the possibilities to manage the ruleset properties such as the name, the description, or to exclude or include some files for an analysis, and of course, the list of PMF rules themselves. In the PMD APEX Ruleset Configuration window, you will see a list of PMD rules, which is divided according to the categories that were mentioned above. You can select the necessary items for analyzing your Apex code by using the checkboxes for each rule, and a convenient counter near each of the categories shows you the general number of category rules that are included, and how many of them are already enabled for your ruleset. 
PMD Apex Ruleset manager in the IDE

When you click on a rule in an expanded category on the left, you will see all the rule's properties and settings in the right part of the window. Here in this place you can find the following information:

  • the name of the PMD rule;
  • the PMD class that realizes the rule;
  • the description of a PMD rule, with the condition when it will be executed;
  • the link to the related documentation;
  • the list of rule's parameters; these setting have also separate sections: 
    • Attributes: you will probably mostly work with these parameters:
      • Priority - according to the value of this attribute, you can set up if a PMD issue, which is found in your Apex code, will be recognized as warnings, which should just highlighted to you, but in general their presence is acceptable for the moment, or like for errors for which you really should pay your attention to, in some part of the code, because you need to solve them for your further working process;
      • Message - a tip about an error, and what should be done to solve the issue; you can use the default PMD messages or write your own;
    • General: additional settings, which are specific for each rule and the values, which will be used during scanning;
    • Code Climate: the parameters which are necessary for PMD analysis, in the cases when you are working with the Code Climate engine; if you don't use the Code Climate engine - you don't need to pay attention to them since PMD scanning in The Welkin Suite uses its own settings instead of these ones.

Also, you will see a short description for each parameter under the list in the right part of the PMD Apex Ruleset Configuration window. We are using all the same default values and descriptions for the PMD parameters and attributes, which are predefined in PMD tool, and you can find all the available PMD documentation directly in The Welkin Suite Blaze R1.

We would also like to draw your additional attention the Priority parameters, and here are the descriptions for each of its values (according to the PMD's guide):

  1. Change absolutely required. Behavior is critically broken/buggy.
  2. Change highly recommended. Behavior is quite likely to be broken/buggy.
  3. Change recommended. Behavior is confusing, perhaps buggy, and/or against standards/best practices.
  4. Change optional. Behavior is not likely to be buggy, but more just flies in the face of standards/style/good taste.
  5. Change highly optional. Nice to have, such as a consistent naming policy for package/class/fields...

When you are working on the settings of the configuration rules for your ruleset, you always have a possibility to reset these settings to the default (or previously saved) values for a rule - a 'Reset rule settings' button has been implemented for this, and it is located above the rule description in the right part of the window.

You can use any of the ruleset xml files which were created, changed, configured in the IDE, or any other template ruleset which is available here for all your TWS projects, for other tools, for your CI, or you can share them with your team-membres.

There are really a lot of PMD rules, and The Welkin Suite support all of them that are available in the 5.6.1 version of PMD. We will update the list of these rules, when any changes would be released or extended.

PMD Execution Settings in TWS: global and for separate projects

In The Welkin Suite IDE, you can use different PMD rulesets for each of your TWS projects, or you can set up the PMD execution based on one the same ruleset for all your projects, as we have implemented both global and project PMD settings for this.

For cases, when you want to run the same PMD analysis for all your projects in TWS,  and you want to check some Apex code according to these same rules, it is convenient to set up the PMD execution globally. You can do this by using this approach: open the menu The Welkin Suite Blaze → Preferences → External Tools → PMD settings. Here you should configure the next options:

  • please enter the path to the ruleset xml file, which you are going to use for PMD tracking; you can use the 'Browse' option for this;
  • enable the 'Run PMD before build' checkbox, if you want to run the PMD execution automatically before updating your Apex files on your Salesforce Organization;
  • in cases where you have enabled the previous option, and PMD will be started each time you are going to save files to an Org, you can specify which PMD issues should be treated as errors, and if they do appear, the build shouldn't start; if the rule discrepancy has this selected priority or higher - it will be marked as an error (thus blocking the build, if you've selected the appropriate option in the previous step), in other cases, this will be detected as a warning in your PMD report.

After you have set up these settings, the PMD analysis will be applied for all your TWS projects.
PMD settings configuration in the IDE

Also, there can be the cases when you want to track, with PMD, just for one of your projects, or perhaps just one of them should be checked according to another PMD ruleset, or any other specifications that are appropriate. So so for that, you can configure the PMD analysis for some separate project in the IDE in the project's properties. The project properties are available for you in the context menu of your project, in the Solution Explorer, or in the toolbar in the menu Project → Project Options. Here in the 'External Tools' section, you will see PMD settings. The configuration of these settings is the same as globally: select a ruleset file, mark if PMD should be run before building the project, and specify the priority threshold.

This set of settings in the IDE allow you to use different PMD rulesets and their parameters for your projects, use the same ruleset for one or for several TWS projects, or even use the same ruleset for all the projects, but with different execution parameters.

If you used PMD for some selected project, the global settings won't affect this project anymore, and in this case, you should set up PMD locally for all further PMD usage.

Also, we want to share one recommendation with you: if you want to use a PMD ruleset xml file for your building on CI, it is necessary to configure PMD on a project level. In this case, the path to the ruleset file will be added to the project file, and this means that you will have all the necessary settings for CI.

PMD Execution in The Welkin Suite

We provided you with the ability to run the PMD execution manually and automatically, or even use both of these options in your TWS project (smile)

You can set up execution of PMD before updating your Apex files on a Salesforce Organization. We mentioned the 'Run PMD before build' option which is implemented for this, and it is located in the general TWS Options, or in the options of any TWS project. When you enable it, PMD will scan the changed Apex files which are included in the build, and if any issues would be found - you will see all of them in the PMD report - we will tell you about this in the next paragraph. At the same time, if some of these issues are detected as errors (in accordance to rule's priority and your settings) - the build process won't start and the errors will be displayed in TWS Error list. Also, you will see the errors highlighted in a code. Furthermore, all the issue which have a priority below the threshold, will be marked as warnings, and they won't influence the build process. So you can solve them later. 

Also, you always can open the context menu of a file, set of files, folder (s), or your project in the Solution Explorer, and use the 'Scan with PMD' option to run a periodical PMD analysis for the selected item (s). This case can be helpful when you want to get PMD results without editing any files or you don't need to run a PMD execution each time before a build, or when you start using PMD, and there for sure will be issues which block your working process, when you updated Apex files on an Org.

You can use both these settings in any case: when you work with PMD globally in the IDE, or when you scan one of your TWS projects.

PMD Results Report

All the PMD issues which would be found during the PMD analysis your Apex code, you can see in a convenient PMD Report. It is available for you in the menu View → Pads → PMD Report. Also, this will be opened automatically if you run the 'Scan with PMD' option for your file(s).

PMD Report in The Welkin Suite

In this report, you will find all the warnings and errors (according to your PMD settings in the IDE or for the project) with appropriate icons. Each issue item in the list contains the following information:

  • name of the PMD rule that has not been met;
  • a rule message with the description what should be done to solve the issue; 
  • name of the file which contains the issue; there is a link which you can use for redirection to the file itself;
  • a category which contains the failed PMD rule.

For easy navigation in the list of PMD issues, you can use the Category filter in the toolbar of the report. By default, the 'All categories' item is selected, and you can switch to any necessary item for you. Also, next to the right, there is the usual text filter to use when searching some needed rule.

Also, directly from the PMD Report, you have a possibility to change your PMD settings - use the 'Settings' icon in the left top corner to open the Options. You will get the opened TWS options, if you have set up PMD settings for the IDE globally, or the project options if you use PMD for just this TWS project.

One more option in the PMD Report is the 'Clear all results' to empty the list.

Getting Started Guide

Together with all the mentioned new functionalities in The Welkin Suite Blaze R1, we want to present you the Getting Started guide. Using it you can easily and conveniently explore all The Welkin Suite features and find more possibilities which can help you in your Salesforce development. We are sure that this is going to be a great and fun way for our current users to stay up-to-date with all the new and maybe more seldomly used, buy still very handy, features, and for our new users to get up-to-speed the fastest.How to use TWS optionsHow to use TWS options

The Getting Started Guide is available for you in the menu Help → Getting Started. If you have just got started using The Welkin Suite IDE, and have the Trial license - you will see it automatically each time when you create or open a project for the first time during your TWS session.

In the Getting Started guide, we provide you with tips and tutorials on how to use the IDE's options and features for your development necessities. In the right part of the guide window, you can see a list of these tips. When you click on any of them, you will get a short description of the selected item, and a 10-20 second overview video at the left. We hope that this way of having a short features 'demo' will be interesting and useful for you. Also, you can get all the detailed information about each item by using the 'Read more' link - it will redirect you to TWS's Documentation with a complete description of how to use it.

Furthermore, We would like to draw your attention to the fact that the list you will be seeing will only show you the tips about the functionality which you haven’t used yet, so it should always interesting for you, as a way to get a new information about TWS features.
Of course, we will keep it updated with each The Welkin Suite release, to introduce you new and new abilities of the IDE.

 

In addition to all the described new features, our developers have implemented some great improvements and solved a lot of issues. You can find Full List of Changes below.

 

This is just beginning of the new series of The Welkin Suite Blaze for Mac, and you can see our next goals and the approximate direction in which we will move in 'The Welkin Suite Release Announcement' article. Of course, there can be some changes on the road, because your feedback and suggestions have a great influence on The Welkin Suite's development, and we carefully listen to them. So if you need something that is absent in our plans, please share your ideas with us in social networks: LinkedIn, Facebook, Twitter, Google+.

Full list of changes

Features

  • Implemented a new Lightning Components and Applications Previewer
  • Implemented built-in PMD support
  • Implemented a Getting Started guide
  • Added Apex Code Completion for Triggers
  • Added Apex Code Completion for Anonymous apex
  • Implemented full support for Apex's built-in Generic types in Code Completion
  • Implemented a one-time dynamic retrieval of standard sObjects and fields for the Code Completion database, from the Organization
  • Added documentation for most of the standard Apex members to the Code Completion suggestion hints

Improvements

  • Updated the Code Completion database with additional standard Apex members, according to the latest documentation
  • Implemented full support for nested types in Apex code for Code Completion
  • Improved Code Completion preselection logic to take the most recently selected item into account
  • Significantly improved the performance of the built-in Code Map (Class outline), and changed it to be expanded by default
  • Improved local variables detection, and handling in Apex Code Completion, especially for loops and try...catch blocks
  • Significantly improved the performance of the Apex editor, especially for large files with 5k+ lines of code
  • Added parenthesis to the methods completion in Apex
  • Added support for the Lightning Previewer in projects without having to specify the information about a custom domain
  • Changed the hotkey for inserting code snippets to 'Ctrl+Shift+K' 

Fixes

  • Fixed multiple various issues related to the Code Assistance functionality
  • Fixed different cases of possible Code Completion absence
  • Fixed TWS crashes caused by using the Code Assistance functionality
  • Fixed multiple cases of incorrect completion preselections in Apex Code Completion
  • Changed the mechanism of obtaining the list of tests with Code Coverage data, to avoid the issue when not all of the test classes were present in the Code Coverage panel
  • Fixed the incorrect UI position of the 'Child ApexTestResults' button in a SOQL query in rare cases
  • Fixed TWS crash during opening a previously created project without the enabled 'Project structure sync' option
  • Fixed rare TWS crashes during the work in the Test Result pad
  • Fixed the error and TWS crash when opening a Lightning file, if there was a bundle with the name that was started with 'Renderer', 'Controller', 'Helper'
  • Fixed the issue related to the incorrect results of a SOQL query if 'Group By' was used in the query
  • Fixed the failed creation of a class file with the 'Exception' word in its name
  • Fixed the issue when the last page in the Local History Details pad was empty
  • Removed the 'Debug Anonymous Apex' button from the context menu of an Anonymous Apex log file
  • Fixed the issue when the same file was present in all rows of the list in the Deployment wizard after using the 'Deep comparison' option
The Welkin Suite for Mac Blaze R1
How to use TWS options
PMD settings configuration
PMD Report in The Welkin Suite
Completion Apex generins in the IDE
Apex local variables completion
Built-in previewer for Lightning Application
Built-in previewer for Lightning Components
PMD Apex Ruleset manager in the IDE

Your comment may be the first

    Please log in to post a comment