2

In the last time I often initialize arrays in this form :

int[] test = new int[]{1,2,3};

When I type '[', NetBeans immediately put the closing brace.

The question is - which is the macro to do the same job with curly braces ?

StKiller
  • 7,631
  • 10
  • 43
  • 56
  • Tools > Options, select Editor in toolbar, go for Code Completion tab. You will see that Insert Closing Brackets Automatically, now just Press Enter It will automatically add closing bracket, – V A S Jun 16 '15 at 11:47

3 Answers3

4

Select from menu Tools > Options, select Editor in toolbar, go for Code Completion tab. You will see that Insert Closing Brackets Automatically is already automatically checked by default.

There was a guy, who asked an analogical question a while ago. There was no helpful answer. I guess that means that we should look for that in future versions.

d1e
  • 6,372
  • 2
  • 28
  • 41
1

I looked for solution too, for NetBeans 8.5 check answer, https://stackoverflow.com/a/38338967/7162006, in same window is option: Completition Selectors For Java add: {, autocomplete by hiting enter in editor. (classically)

Community
  • 1
  • 1
Majo
  • 11
  • 2
  • 1
    Welcome to Stack Overflow, and thanks for contributing. Your answer may be correct, if you read http://stackoverflow.com/help/how-to-answer you can see the guide lines for posting answers – Mikkel Jan 21 '17 at 19:51
  • When you hit enter after typing the opening curly brace, the one that closes is automatically added. Not before. – Arturo Rosales Baez Feb 06 '19 at 00:10
0

This macro work to me:

Shortcut: Shift + {

Macro code: "}" caret-backward

Eko Setiawan
  • 210
  • 2
  • 9