Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Incorrect formatting of Javascript line comments
Incorrect formatting of Javascript line comments [message #532730] Tue, 11 May 2010 03:43 Go to next message
Kian Win Ong is currently offline Kian Win Ong
Messages: 2
Registered: May 2010
Junior Member
Hi,

In both Eclipse 3.5 and 3.6 M7, the Javascript formatter seems to mangle code indentation badly in certain cases.

If line comments are used in either conditional blocks or function bodies, the Javascript formatter produces:

f(x, function() {
    function g() {
        if (true) {
            // Comment
        return true;
    } else {
        // Comment
        return false;
    }
}
});

f(x, function() {
    function g() {

        forEach( [], function() {
            // Comment
                var x = 1;
            });
    }
});


The formatter, however, produces the correct output for block comments.

f(x, function() {
    function g() {
        if (true) {
            /* Comment */
            return true;
        } else {
            /* Comment */
            return false;
        }
    }
});

f(x, function() {
    function g() {
        forEach( [], function() {
            /* Comment */
            var x = 1;
        });
    }
});


Shall I file a bug for this?

Thanks in advance!

- Kian Win
Re: Incorrect formatting of Javascript line comments [message #532993 is a reply to message #532730] Tue, 11 May 2010 18:35 Go to previous messageGo to next message
sNop is currently offline sNop
Messages: 281
Registered: July 2009
Senior Member
Hi,

>
> Shall I file a bug for this?
>

You should
Re: Incorrect formatting of Javascript line comments [message #533007 is a reply to message #532993] Tue, 11 May 2010 19:48 Go to previous message
Kian Win Ong is currently offline Kian Win Ong
Messages: 2
Registered: May 2010
Junior Member
Filed as:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=312494

Thanks!
Previous Topic:Javascript/CSS Syntax highlighting within custom tag
Next Topic:spring 2.5.6 annotation based web controller
Goto Forum:
  


Current Time: Tue Sep 16 19:45:16 GMT 2014

Powered by FUDForum. Page generated in 0.02026 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software