Editing Groovy Source Files
See Also
The IDE's built-in Source Editor enables you to
view, create, and edit your Groovy source code.
You can open the Source Editor
window by double-clicking an editable element in the Projects window or by choosing
File > New to create a new file.
The IDE has many features to simplify coding of Groovy files such as:
- Code completion.
After you press Ctrl-Space, a dialog box appears and offers possible ways of completing the expression
you are typing.
- Code templates.
You can enter common code snippets by typing abbreviations for those snippets
and then pressing Tab.
- Editor hints. For some common coding mistakes,
the Source Editor provides hints for adding the missing code and offers to add the
code for you automatically. To display hints, choose Source > Fix Code (Alt-Enter).
- Word match. After you type the beginning
characters of a word used elsewhere in your code and then press Ctrl-K, the Source Editor generates
the rest of the word.
- Inplace Rename. Select a word in the editor, press Ctrl-R,
and then all other instances of the current word will change together
with the current word that you are changing.
- Code Folding. Enables you to hide
sections of code, such as Javadoc comments and method bodies.
- Pair Completion, Smart Enter, and
Smart Semicolons. When you type a quotation mark, bracket, brace,
or parenthesis, the Source Editor automatically inserts the closing character.
The matching is "smart", so the closing characters are not duplicated if you
type them yourself.
- Import Management. The Ctrl-Shift-I keyboard
shortcut helps you generate missing import statements for the file.
- See Also
- About Working with Groovy
- Enabling a Java Application to Support Groovy
Legal Notices