This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 158386 - Switching off auto-brackets also stops auto-alignment
Summary: Switching off auto-brackets also stops auto-alignment
Status: RESOLVED FIXED
Alias: None
Product: groovy
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.0
Hardware: All All
: P3 blocker with 6 votes (vote)
Assignee: Martin Janicek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-11 12:27 UTC by pfernley
Modified: 2012-12-13 02:39 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pfernley 2009-02-11 12:27:47 UTC
Maybe this is pushing my luck a bit, but I have switched off 'Insert closing bracket automatically' in the editor but 
this also stops the editor making any attempt to align the brackets once I add the closing bracket manually. It would 
be nice if the two aspects of closing brackets were kept separate so that switching off auto-completion did not also 
switch off auto-alignment. Well, I can ask can't I !!
Comment 1 Miloslav Metelka 2009-02-20 12:46:17 UTC
Switched "Insert closing brackets automatically" off. I've tried to type

if (true) {
<Enter>

The closing '}' was not inserted. When typing it manually then it was reindented appropriately automatically. So I assume you've probably meant something 
else. Could you please give an example? Thanks.
Comment 2 pfernley 2009-02-20 13:44:47 UTC
With "Insert closing brackets automatically" switched off, what I was hoping it would do (after manually typing in the 
closing bracket followed by return) would be to end up looking like this...

if (true) {
}

...however it ends up looking like this...

if (true) {
    }

When I logged this request, I was editing Groovy files where this behaviour happened (and still happens). Before your 
response to me, I just so happened to edit a Java file and, Bingo, it worked just as I would want it to in the Java 
file - but not the Groovy file.
Comment 3 Miloslav Metelka 2009-02-23 10:58:04 UTC
I see it's a defect in the groovy indenter then.
Comment 4 trobbins 2009-08-21 19:01:26 UTC
this is also a problem in the jsp editor.
Comment 5 Petr Hejl 2009-09-25 20:06:03 UTC
I believe this is problem in any csl/gsf based language (at least groovy, javascript and php).

I'm not an editor internals expert but debugger shows that ef.getReformatBlock() call in ExtKit.checkIndentHotChars()
returns always null in csl context so reformat is not called.

Any suggestions how this should be handled/fixed?
Comment 6 Petr Hejl 2009-09-25 20:07:13 UTC
This affects many other languages.
Comment 7 Petr Hejl 2009-10-06 14:15:06 UTC
As I suggested common problem for CSL languages...
Comment 8 newfurniturey 2011-05-16 04:15:51 UTC
This issue (still) exists with PHP in NetBeans 7.0 (Build 201104080000); (I also have noticed it it v6.9).

In any instance with a opening/closing brace, the closing brace does not align with the opening brace's line.

It is the same as described in Comment #2 (except with PHP). Also, along with Comment #2, the auto-alignment of the braces works fine in Java.
-----
it should be:
if (true) {
}
...however it ends up looking like this...
if (true) {
    }
-----

Please fix!
Comment 9 ceklock 2011-10-04 20:59:13 UTC
Similar issue:
http://netbeans.org/bugzilla/show_bug.cgi?id=158386
Comment 10 ceklock 2011-10-04 21:00:14 UTC
(In reply to comment #9)
> Similar issue:
> http://netbeans.org/bugzilla/show_bug.cgi?id=158386


Ops, wrong link... The correct is:
http://netbeans.org/bugzilla/show_bug.cgi?id=203087
Comment 11 MikeJerome 2012-03-29 20:51:16 UTC
Just created an account to say that this is a game-breaking bug for me and it is the only reason keeping me from using NetBeans.
Comment 12 Dusan Balek 2012-04-24 14:01:38 UTC
Typing Hooks API should be used to solve this problem.
Comment 13 Martin Janicek 2012-04-24 14:23:07 UTC
Dusan, could you be a little more specific? What do I need to do on the Groovy side to make this work properly? As far as I understood the discussion this isn't groovy language specific problem (referred comment #5 it's more a csl issue)
Comment 14 Martin Janicek 2012-09-04 13:41:45 UTC
Reassigning to CSL (CslEditorKit should be changed and use Typing Hooks API instead of the old deprecated solution - see Editor Library 2 module for more information about Typing Hooks API)
Comment 15 Milutin Kristofic 2012-11-07 16:19:39 UTC
I am sending back.

Groovy Editor or another client should implement their own TypingHooks and delete old KeystrokeHandler. 

See coming changes in Bug #217163
Comment 16 Martin Janicek 2012-11-19 12:46:37 UTC
Setting TM to Next. I don't want to rewrite the code to use Typing Hooks few weeks before 7.3 FCS. I'm going to do this in the early 7.4 development..
Comment 17 Martin Janicek 2012-12-11 07:46:40 UTC
Fixed for groovy in: web-main #7a71d98c1c5f
At the end it wasn't needed to rewrite code with Typing Hooks API. Anyway I'll do that in early 7.4 as the new API looks much better than the old KeystrokeHandler.
Comment 18 Quality Engineering 2012-12-13 02:39:39 UTC
Integrated into 'main-golden', will be available in build *201212130001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/7a71d98c1c5f
User: Martin Janicek <mjanicek@netbeans.org>
Log: #158386 - Switching off auto-brackets also stops auto-alignment