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 222239 - Javascript adding extra }
Summary: Javascript adding extra }
Status: RESOLVED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.3
Hardware: PC Linux
: P3 normal (vote)
Assignee: Petr Hejl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-15 23:28 UTC by herent
Modified: 2012-11-21 13:41 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
php file with inline javascript that shows problem (8.50 KB, application/x-php)
2012-11-16 15:09 UTC, herent
Details

Note You need to log in before you can comment on or make changes to this bug.
Description herent 2012-11-15 23:28:10 UTC

    
Comment 1 herent 2012-11-15 23:30:50 UTC
Huh, sorry, this submitted accidentally.  

When I'm using the php version of the 7.3 beta, when I'm editing javascript hitting enter within a function _always_ adds a closing } tag.  So if you have something like:

showYouTube: function() {
}

Then hit enter to fill in the body, you get this:

showYouTube: function() {

}
}

If you type in more, then hit enter again, you get another bracket:

showYouTube: function() {
    // do something

}
}
}


I'm not really sure if that's intended or a bug, but it really seems like a bug.  This is in an inline javascript section on a php page.
Comment 2 Martin Fousek 2012-11-16 09:12:08 UTC
Sorry, I'm not facing your troubles in the latest builds. Could you give it another try in the beta2 or development builds?
http://bits.netbeans.org/download/trunk/nightly/latest/

It looks that this was already fixed or you must have some structure which is making still troubles. So if you would be able to reproduce in the build mentioned above, please attach your JS code where it's making troubles to you.

Or feel free to attach your whole JS source right now, we can give it a try. For now I'm closing that as worksforme since I wasn't able to reproduce it on pieces of sources attached below - in the .js or .php files.
Comment 3 Martin Fousek 2012-11-16 09:13:16 UTC
As I mentioned, marking as worksforme for now, but your source would be appreciated, to check it fully in the latest builds. Thanks a lot...
Comment 4 herent 2012-11-16 15:09:42 UTC
Created attachment 127943 [details]
php file with inline javascript that shows problem

Here's an example that does it.  At the very end of the php file, there's some inline javascript with some conditional sections based on php. In the javascript 'empowered' object, there are several functions. If you hit enter inside of any of those functions, it will create a closing bracket, even though the bracket already exists.

It doesn't do it in every section of the javascript, so it might be something related to this specific code, but I've seen it in other files.

This is with the latest nightly build, php only.  Java on this particular machine is Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
Comment 5 Martin Fousek 2012-11-16 18:53:17 UTC
Thanks for attaching your source, it's definitely reproducible on that. Reopening this issue...
Comment 6 Petr Hejl 2012-11-16 22:03:26 UTC
It has to be something about the code. The object itself in plain js or html does not cause that.
Comment 7 Petr Hejl 2012-11-16 22:27:22 UTC
The problem is that typed break interceptor is looking for balance on whole document.
Comment 8 Petr Hejl 2012-11-19 13:50:19 UTC
Should be fixed in web-main 695df08bb318.
Comment 9 Quality Engineering 2012-11-21 13:41:45 UTC
Integrated into 'main-golden', will be available in build *201211211016* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/695df08bb318
User: Petr Hejl <phejl@netbeans.org>
Log: #222239 - Javascript adding extra }