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 237700 - Remove hint: 'Expected Semicolon after braces'
Summary: Remove hint: 'Expected Semicolon after braces'
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.4
Hardware: PC Linux
: P3 normal (vote)
Assignee: Petr Pisl
Depends on:
Reported: 2013-10-27 10:35 UTC by digitman222
Modified: 2013-11-30 00:49 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:

screenshot (86.00 KB, image/png)
2013-10-27 10:35 UTC, digitman222

Note You need to log in before you can comment on or make changes to this bug.
Description digitman222 2013-10-27 10:35:09 UTC
Created attachment 141593 [details]

I'm attaching a screenshot for one of my classes. Its a perfectly good, working, and very readable file, but my screen is riddled with warnings because I haven't put semi-colons after ending braces i.e } .

While javascript accepts the syntax of putting semicolons after braces, most other c-like languages like PHP, Java, C++, C, etc do not  accept semi-colons after braces, and if someone uses PHP or Java for the server-side and javascript for client side, its a real pain to remember to put or not put the semi-colons. Plus, it offers no advantage since there's always a line break after the ending brace.

So, could this hint be removed, or at least be made optional? I'm talking specifically about the semi-colon after braces. I DO want warnings if I miss a semi-colon after a normal line, but putting it after braces is unnecessary.

Right now this hint cannot be disabled either and its forced on to you.
Comment 1 Petr Pisl 2013-11-28 10:17:43 UTC
You can disable the hint in Tools-
Comment 2 Petr Pisl 2013-11-28 10:18:35 UTC
Hmm, last my comment was not save correctly.

You can disable the hint in Tools-Option-Editor-Hints, where you choose JavaScript language and uncheck the Missinh semicolon hint. 

IMHO it's a good practice to add the semicolon there.

Marking as wantfix, because the functionality for disabling is here.
Comment 3 digitman222 2013-11-29 04:04:11 UTC
You are missing the point. I DO want the hint for missing semicolons everywhere except on the lines where there is a closing brace. E.g:

x = y (should show hint)

function y()
} (should not show hint)

This is in line with all the major languages of the day including C, C++, Java, PHP, etc where putting a semicolon after a closing brace results in a syntax error. Just because javascript allows it doesn't mean its good practice.

So, either the existing setting should be modified so it ignores when there's no semicolon after a closing brace, or it should be split into two settings.
Comment 4 Vladimir Riha 2013-11-29 07:36:04 UTC
(In reply to digitman222 from comment #3)
> Just because javascript allows it doesn't mean its good
> practice.

Actually it is a good practice, see for instance [1]. Also it worth mentioning that line breaks does not always guarantee "break" in code that you would expected, for instance try following:

var fnc = function() {

(function() {

And compare the result with

var fnc = function() {

(function() {

It is 2 completely different results and only difference is a one semicolon.

Just my 2 cents.

Comment 5 digitman222 2013-11-30 00:49:11 UTC
Perhaps its a good practice for those who are using functional programming, but that's a small percentage of people. Please split this option into two, one for semicolon hints in other places, and the other for semicolon hints after braces, so people can enable the settings according to their needs.