shifting responsibilities
April 18, 2019

Introducing Code Insights for ScriptRunner

3 minute read

We are excited to announce a new collection of features called ‘Code Insights’ have been added to ScriptRunner’s Code Editor.

Code Insights simplifies the process of writing scripts in ScriptRunner.

The Code Editor is used by thousands of our users daily. However, we realised the editor could be improved by introducing a host of new smart features. Our aim is for you to write scripts with confidence whilst increasing productivity and decreasing errors. With more discovery options available, such as exploring the API rather than searching the documentation, you will save time and reduce your manual efforts.

In this blog, we will be explaining what these Code Insights are and how they can be used to benefit you. A handy demo video has also been created to illustrate how these new features work in practice. 

Check out this beer mat we made for Atlassian Summit, now you can never forget these handy shortcuts: 

 

 SR4J Beer Coaster front4

 

Code Completions

You can now press Ctrl+space in order to complete the current class, method, property or variable.

This new feature helps you by displaying a list of suggestions based on what you have written in the Code Editor. As you can see below, you can select a completion or continue typing to narrow down the suggestions.

 Code complitions

Parameter Hints

Pressing Ctrl+p when inside ‘method parameters’ makes finding all the possible parameter types available for a method in the Code Editor easy.

We understand it’s common to forget the expected types when typing method parameters. So, we have introduced this feature to display all the possible parameter types applicable.

To make it easier for you to choose the parameter types, we have set bold items to indicate the parameter being entered or edited. Greyed out items are methods that are incompatible with the parameters typed.

parameter hints

Javadoc Lookup

When you have hundreds of methods and properties, it’s difficult to keep track of what each one does. We have introduced Javadoc Lookup into the Code Editor to simplify the process by linking to the Javadoc for each method, property, or class.

Press Ctrl+j when the cursor is on a method, property, or class, to open the Javadoc for this symbol in a new browser tab.

Please note: the below image is illustrative. The Javadoc opens in a new tab, if you request the Javadoc for a different method, the same tab is reused. Javadoc currently works for the Java and Groovy standard libraries, and the Jira API only.

javadoc lookup

Code Insight Demo Video

The below demo video shows you how to use the new Code Insight features to set up a validator to run a JQL query with the value of a custom field. This makes sure there are no other issues within the same project having that custom field.

 

Start your free trial:

If you haven’t tried using ScriptRunner for Jira yet, get a 30-day free trial here: