Tern.java doesn't respect the [ ] Expand function? preference and always expands
Using tern.java 1.2.0 from http://oss.opensagres.fr/tern.repository/1.2.0/. Per my understanding of https://github.com/angelozerr/tern.java/wiki/Tern-Advanced-Completion#expand-function the expand function preference gives multiple entries for the auto-completion. I turned this preference off, but it seems it is not respected.
I turned on trace debugging and see that the completion from tern.js itself doesn't contain duplicate entries, nor do the completion suggest that the methods can have different expansions:
{
"start": 19,
"end": 23,
"isProperty": true,
"isObjectKey": false,
"completions": [
{
"name": "getData",
"type": "fn(type: string) -> string",
"doc": "Retrieves the data for a given type, or an empty string if data for that type does not exist or the data transfer contains no data.",
"url": "https:\/\/developer.mozilla.org\/en\/docs\/DragDrop\/Drag_Operations",
"origin": "browser"
},
{
"name": "getDate",
"type": "fn() -> number",
"doc": "Returns the day of the month for the specified date according to local time.",
"url": "https:\/\/developer.mozilla.org\/en-US\/docs\/JavaScript\/Reference\/Global_Objects\/Date\/getDate",
"origin": "ecma5"
},
{
"name": "getDay",
"type": "fn() -> number",
"doc": "Returns the day of the week for the specified date according to local time.",
"url": "https:\/\/developer.mozilla.org\/en-US\/docs\/JavaScript\/Reference\/Global_Objects\/Date\/getDay",
"origin": "ecma5"
}
]
}
This seems to be a bug?
The expand function is done on client side and not by ternjs. The idea is to provide the full signatures of a method. Imagine that ternjs returns. A sample is
String#indexOf(elt: ?, from?: number)
You will have this completion:
- with expand:
var a = "";
a.index // here Ctrl+Spcae shows indexOf, indexOf(char) and indexOf(char, from)
- with no expand:
var a = "";
a.index // here Ctrl+Space shows indexOf, and indexOf(char, from)
@angelozerr Thanks for the reply. It seems you are saying that the behavior that I see in my example is not due to turning expansion on/off since the method signature doesn't have any ?optional parameters
"name": "getData",
"type": "fn(type: string) -> string"
In that case, what option(s) do I need to do on the client side to turn off the double entries of
getData()
getData(fn)
I know that this is possible since your own example at https://github.com/angelozerr/tern-browser-extension does not have the double entries. See the screenshot below from running the demo.

As I said you, the expand is done on client side. With tern.java I have hard coded if I remember the completion to show the fn and fn with signature.
It doens't exist none preferences to disable that. I will do it when I will find time.