tern.js is a stand-alone code-analysis engine for JavaScript written in Javascript.
Orion is an Open Source Platform For Cloud Based Development. It provides a standalone code editor written in JavaScript (built-editor.js and built-editor.css).
tern.orion gives you the capability to use tern.js in a Orion editor like the CodeMirror Tern addon
Note that Orion could be interested to integrate Tern. See bug 432940
You can find too an Eclipse IDE wizard which generates Orion editor with Tern.
If you open completion, on Array variable, you will see functions of the array :
If you apply the completion, it will generate the signature of the selected function :
Use tab, to switch to next parameter.
See here for more samples of completion (jQuery, Angular, etc).
Import in your HTML page :
- Orion editor built-editor.js and built-editor.css
- tern-orion.js
Create Orion editor and add tern completion :
require(["orion/editor/edit", "orion/tern/ternServer"], function(edit, mTernServer) {
var editor = edit({
lang: "js"
});
// tern server
var defs = []; // load defs
var plugins = {}; // load plugins
var ternServer = new mTernServer.TernServer({defs: defs, plugins: plugins});
// tern completion
ternServer.addContentAssistProvider(editor);
});
The basic structure of the project is given in the following way:
demos/
demos with Tern and Orion. Open tern-orion.html.lib/
containstern-orion.js
which is the glue between Tern and Orion.