UPDATE: I meant that in my answer, but to clarify - Tern will do exactly what you ask in what I want . Below is a snippet below one of the problems associated with providing some context that you do not want to see even in the editor. See screenshots of your code used in Ace.Tern live demo

This is an assumption, but imo is the best option for adding autocomplete to ace Tern .
The turn accepts a typedef configuration parameter (described here: http://ternjs.net/doc/manual.html#typedef ), but more interestingly, it will accept your custom js object as a child, i.e.:
var myContext = { name: 'myContext', obj: obj }
Where obj is your js object. Then in the Tern configuration, you will use it as:
defs: ['underscore', myContext]
which will use both your custom object and the underline module for autocomplete.
Related to Tern ace.js config: (see https://github.com/sevin7676/Ace.Tern/blob/master/demo.html for comments on configuration settings)
var myContext = { ... } var editor = ace.edit("editor"); editor.getSession().setUseWorker(true); ace.config.loadModule('ace/ext/tern', function () { editor.setOptions({ enableTern: { defs: ['browser', 'ecma5', myContext], plugins: { doc_comment: { fullDocs: true } }, useWorker: true, startedCb: function () { console.log('editor.ternServer:', editor.ternServer); }, }, enableSnippets: true, enableBasicAutocompletion: true, }); });
vittore
source share