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

Bug 437963

Summary: Trailing comment causes no JSDoc to be inserted using 'Create Element Comment' command
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: JS ToolsAssignee: Michael Rennie <Michael_Rennie>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: 6.0 RC3   
Hardware: PC   
OS: Mac OS X   
Whiteboard:

Description Michael Rennie CLA 2014-06-23 12:49:01 EDT
Consider the following snippet:

var bar = 10; //trailing comment

function foo() {
    bar = 11;
}

1. put the cursor in the 'function' keyword
2. use the menu item or command to insert the JSDoc 
3. nothing happens

The problem is that the trailing comment from the var decl and the leading comment for the func decl are set to be the same (in esprima) - so the logic assumes there is already a comment and does nothing.

The best solution here would be to copy how JDT works - it doesn't matter if there is a comment, just insert every time you activate the commend (rather than try to do something cleaver).