I am trying to print autocompletion of a js file using nodejs and tern. Ternjs has the worst documentation i have ever seen.
var tern = require("tern")
var ternServer = new tern.Server({})
var requestDetails = {
"query": {
"type": "completions",
"file": "myfile.js",
"end": {"line":0,"ch":3},
"types":true,
"includeKeywords":true,
"sort":true,
"guess":true,
"docs":true,
"urls":true,
"origins":true,
"lineCharPositions":true,
"caseInsensitive":true
},
"files": [
{
"type": "full",
"name": "myfile.js",
"text": 'req'
}
]
}
ternServer.request(requestDetails, function(error, success){
console.log(success);
});
Its not working though if I use con it provided continue and const. But not after that. While in atom plugin it provided require module autocomplete. Am i missing something.
Also this is the .tern-project file
{
"ecmaVersion": 6,
"libs": [
"browser",
"jquery",
"requirejs",
"commonjs"
],
"plugins": {
"complete_strings": {
"maxLength": 15
},
"node": {},
"lint": {},
"doc_comment": {
"fullDocs": true,
"strong": true
}
}
}