Posts Tagged ‘Groovy’

Groovy support improvements in IntelliJ IDEA 11.1

Tuesday, April 3rd, 2012

Here I would like to tell you about some of the Groovy language support improvements available in IntelliJ IDEA 11.1.

Unused Symbol Highlighting

If a class, method or property is unused even if it is in fact public, you may notice it immediately with new unused symbol highlighting feature.

(more…)

IntelliJ IDEA 11.1 EAP build 116.108

Wednesday, March 14th, 2012

Probably the last EAP build (before RC) of IntelliJ IDEA 11.1 is available for download.

New settings are added to Groovy Colors & Fonts settings to highlight local variables, parameters, reassigned local variables, reassigned parameters and method declarations in the editor.

This build includes a notable enhancement in JavaScript code completion: the variants are now ordered by “inheritance”. Also worth noting is that editing large CSS files should be significantly better now.

Check the other changes in the release notes.

Your feedback is very important at this point.

Chained expression completion in IntelliJ IDEA 11.1

Monday, February 20th, 2012

If you use completion autopopup in IntelliJ IDEA 11, you may have seen “n variants…” suggestions:

This means there are two StringUtil classes available, neither of them is imported, and IDE can’t choose which of them to put to the first place. When you choose such variant no new import statements will be added. The good side is that you won’t get wrong imports after pressing space, dot or a bracket. The bad side is that you eventually have to face this choice: you may either explicitly invoke completion (Ctrl+Space) again or choose the correct qualified name from the auto-import hint which appears after choosing the item.

Here’s a good news though, now (since IntelliJ IDEA 11.1) you don’t ever have to choose the qualified name. In this particular case, you just type a dot, no import is inserted as before, but the next completion autopopup will list all the possible static members from both possible StringUtil classes:

Needless to say, after you choose the method you want all the necessary imports will be added.

In fact, this feature is even more powerful. It tries to enumerate all the completion variants matching the non-existent qualifier and suggest chained calls based on this. So you may spare some typing even if you don’t use autopopup (or have hit dot too early before it appeared):

Ah, yes, this works in Java and Groovy code.

New in 10.5: Create and open tests for Groovy classes faster

Tuesday, April 26th, 2011

We’ve added a couple of new productivity features in IntelliJ IDEA 10.5 to make working with Groovy tests two bits more pleasant:

1. Now you can create tests for Groovy classes the same way you do in Java. You just need to invoke Create Test intention on the header of the class.

2. To navigate to an existing test from a class you can invoke Go to Test action (Ctrl+Shift+T by default).

Make sure to try it in the latest IntelliJ IDEA 10.5 EAP build.

Quick prototyping in Groovy with “Convert Map to Class” intention

Tuesday, April 19th, 2011

Sometimes it is helpful to use a Map for fast prototyping of classes with some properties but without any logic. But in the end it would be nice to have a real class. In IntelliJ IDEA you can get it by invoking “Convert Map to Class” intention on a map.

You only need to type a name and a package for a new class:

And you’ll get something like this…

and a UserInfo class:

Quick and easy, right?

It is not something new, it’s been in IntelliJ IDEA for a while already. We just felt you might not be aware of it.

New in 10.5: Introduce Refactorings for Groovy

Wednesday, April 13th, 2011

In the upcoming IntelliJ IDEA 10.5 some new Groovy refactorings will appear.

The first of them is Introduce Parameter. It allows you to select any expression inside a method and make from it a new method parameter. All the usages of the method in both Groovy and Java will be auto-updated.
Introduce parameter dialog

The second one is Introduce Field which provides you with an ability to quickly create a new field from any expression inside a class.

No doubt these 2 introduce refactorings will be a good addition to the existing Introduce Constant and Introduce Variable. You are using them, right?

Download the latest EAP build of IntelliJ IDEA 10.5 to try these and other new features and to let us know what you think.

Grails: extracting text from GSP to resource bundle

Wednesday, October 27th, 2010

By user requests we have added functionality for easy extraction of GSP text to resource bundles. To do this you can select a text fragment, press Alt+Enter and choose the intention “Extract selected text to messages.properties”:

I18nize String dialog will open:

This feature is available in IntelliJ IDEA X #98.231

Grails: debugging GSP

Friday, October 22nd, 2010

Now IntelliJ IDEA X is able to debug GSPs. You can set breakpoints and view variable values or evaluate expressions.

Grails: GSP aware of model returned from controller

Wednesday, September 22nd, 2010

As you already know, we are working on GSP editing improvements in IntelliJ IDEA X. In particular, now the editor knows about the variables that the controller supplies to the view.

Example:

Consider an action returning a bookList variable:

And the corresponding GSP file has access to this variable:

Rename, completion and find usages work as they should.

Grails: completion of controller and action names

Wednesday, September 15th, 2010

We have added more Grails-specific completion in IntelliJ Idea X. In particular, IntelliJ IDEA now knows about action and controller names in most places where they can appear.

In the ‘controller’ and ‘action’ attributes of some GSP tags:

In some method calls (e.g. redirect(…), render(…), chain(…)):

In the URL mappings configuration:

Needless to say, find usages and rename work for such references as well.