Skip to main content



      Home
Home » Language IDEs » ServerTools (WTP) » Incorrect formatting of Javascript line comments
Incorrect formatting of Javascript line comments [message #532730] Mon, 10 May 2010 23:43 Go to next message
Eclipse UserFriend
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 14:35 Go to previous messageGo to next message
Eclipse UserFriend
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 15:48 Go to previous message
Eclipse UserFriend
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: Sat Jul 12 12:55:51 EDT 2025

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

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

Back to the top