prototyping hooking up ternjs to power codehints.

Currently only works in 1 file
tern does not yet run in a web worker
Code Hinting plugin now uses tern hints for property completions, and falls back to its own heuristics if tern does not have any hints.
This commit is contained in:
Erik Tierney committed 2013-03-18 15:14:53 -04:00
1 parent 81ef26d05d
commit 832aaa2e14
2 files changed
+75 -9

No files matched your search

@@ -538,14 +538,20 @@ define(function (require, exports, module) {
hints;
if (type.property) {
hints = copyHints(this.properties);
if (type.context &&
Object.prototype.hasOwnProperty.call(this.associations, type.context)) {
association = this.associations[type.context];
hints = HintUtils.annotateWithAssociation(hints, association);
hints.sort(compareProperties(association, this.path, offset));
} else {
hints.sort(compareProperties({}, this.path, offset));
var ternHints = ScopeManager.getTernHints("dir", "file", offset, this.editor.document.getText());
if( ternHints && ternHints.length > 0 ) {
hints = ternHints;
}
else{
hints = copyHints(this.properties);
if (type.context &&
Object.prototype.hasOwnProperty.call(this.associations, type.context)) {
association = this.associations[type.context];
hints = HintUtils.annotateWithAssociation(hints, association);
hints.sort(compareProperties(association, this.path, offset));
} else {
hints.sort(compareProperties({}, this.path, offset));
}
}
} else {
hints = copyHints(this.identifiers);