开发者

Netbeans Auto-Indentation and Curly Braces }{

开发者 https://www.devze.com 2023-04-07 17:43 出处:网络
Is it possible to set up the NetBeans editor to automatically unindent closing curly braces? I want this开发者_开发百科:

Is it possible to set up the NetBeans editor to automatically unindent closing curly braces?

I want this开发者_开发百科:

if (something){
    do thing one;
    do thing two;
}

Netbeans gives me this:

if (something){
    do thing one;
    do thing two;
    }

and then I have to delete the four preceding spaces which is annoying. It would be nice if it would automatically unindent after typing the closing brace.

Any ideas?

Is it possible to do this with a macro?


I ended up asking this on the netbeans forums and it turns out that it's a bug. If you have 'auto-insert braces' turned off, the braces won't align automatically, but everything works fine with 'auto-insert braces' turned on.


NetBeans, as any other IDE, formats automatically the code (by default).
So, when you insert the closing } it will remove the unnecessary spaces automatically.

Anyway, you can select SourceFormat or press Alt+Shift+F to re-format the code.

0

精彩评论

暂无评论...
验证码 换一张
取 消