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

Bug 357496

Summary: [content assist] No content assist for optional parameters
Product: [WebTools] JSDT Reporter: Ingo Rau <ingo.rau>
Component: GeneralAssignee: Project Inbox <jsdt.javascript-inbox>
Status: NEW --- QA Contact: Chris Jaun <cmjaun>
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Ingo Rau CLA 2011-09-13 10:08:09 EDT
Build Identifier: 20110615-0604, JSDT: 1.3.0.v201103031824

The content assist does not work for optional parameters.

Code snippet:
---------
/**
 * @constructor
 * @returns {Class}
 */
function Class()
{
	this.op = function() { };
}

/**
 * Does something.
 * 
 * @param {Class} mandatoryParam mandatory parameter
 */
function f1 (mandatoryParam)
{
	mandatoryParam.op(); // <== Content assist works
}

/**
 * Does something.
 * 
 * @param {Class} [optionalParam] optional parameter
 */
function f2 (optionalParam)
{
	optionalParam.op(); // <== NO CONTENT ASSIST
}
---------

This should work just the same, shouldn't it?
Like this, the [] are no use, as I have to drop them and get back to the good old "(optional)" after the parameter description...

Reproducible: Always
Comment 1 Ingo Rau CLA 2011-09-13 10:59:50 EDT
I just realized one more thing:
Context help (mouse hover over the method op) doesn't work in both cases. However, it works with this code added to the end
----------
var xyz = new Class();
xyz.op(); // <== Content assist works, help works
----------