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

Bug 426612

Summary: [content assist] Functions should be proposed as member completion if they have interesting properties
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: JS ToolsAssignee: Project Inbox <orion.client-inbox>
Status: RESOLVED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: ken_walker
Version: 5.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Mark Macdonald CLA 2014-01-24 14:12:24 EST
Consider a library exporting a FooClient function that users can either invoke as a function (perhaps a constructor function, through `new) (1), or access as a member (2):

1)
> var lib = require("mylib");
> lib.FooClient() 

2)
> require("mylib").FooClient.connect("url");

> The Tern index might look like this (I think)
> {
>   "!define": {
>       "mylib": {
>           "FooClient": {
>               "!type": "fn()",
>               "connect": "fn(options : String)",
>               "prototype": {
>                  /* instance methods of FooClient would go here, if it had any */
>               }
>           }
>       }
>   }
> }

Currently when you trigger content assist on require("mylib"), we only propose FooClient() as a function call, not FooClient as a member. I expected to see both.

However, I only want to see the member proposal when FooClient has a non-default property defined on it (like connect() above). If FooClient had no interesting properties, I should only see the function-call proposal.

---------------
There's a concrete example of this in the mongodb index. "MongoClient" is supposed to be callable as a constructor but also has a static "connect()" function defined on it. But since MongoClient is not proposed as a member, the static connect() is not discoverable.
Comment 1 John Arthorne CLA 2015-05-05 14:43:39 EDT
Closing as part of a mass clean up of inactive bugs. Please reopen if this problem still occurs or is relevant to you. For more details see:

https://dev.eclipse.org/mhonarc/lists/orion-dev/msg03444.html