Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312494

Summary: Incorrect code indentation when formatting Javascript with line comments
Product: [WebTools] JSDT Reporter: Kian Win Ong <eclipse>
Component: GeneralAssignee: Ian Tewksbury <itewksbu>
Status: CLOSED DUPLICATE QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: cmjaun, eclipse
Version: unspecified   
Target Milestone: 3.2 RC4   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
line-comments-wrong.txt
none
block-comments-correct.txt none

Description Kian Win Ong CLA 2010-05-11 15:40:42 EDT
Build Identifier: 20090621-0832, 

The Javascript formatter mangles code indentation badly, when line comments are used in either conditional blocks or function bodies.

Replacing the line comments with block comments will, however, produce the correct indentation.

Please see attached files for comparison between using line comments and block comments.

Reproducible: Always

Steps to Reproduce:
1. line-comments-wrong.js show incorrectly formatted Javascript, whereas block-comments-correct.js shows that replacing line comments with block comments produces correct formatting.
Comment 1 Kian Win Ong CLA 2010-05-11 15:44:43 EDT
Created attachment 168014 [details]
line-comments-wrong.txt
Comment 2 Kian Win Ong CLA 2010-05-11 15:45:56 EDT
Created attachment 168015 [details]
block-comments-correct.txt
Comment 3 Kian Win Ong CLA 2010-05-11 15:46:59 EDT
Also occurs on Eclipse 3.6 M7, Build 20100506-2000
Comment 4 Chris Jaun CLA 2010-06-21 13:57:29 EDT

*** This bug has been marked as a duplicate of bug 315234 ***