Fix problem where hints are displayed before tern has finished computing the completions.

This means there is now a delay on the first request for hints.
This commit is contained in:
Erik Tierney committed 2013-03-21 16:18:32 -04:00
1 parent 9689288dec
commit d648572395
3 files changed
+50 -11

No files matched your search

@@ -40,6 +40,7 @@ define(function (require, exports, module) {
function Session(editor) {
this.editor = editor;
this.path = editor.document.file.fullPath;
this.ternHints = [];
}
/**
@@ -538,7 +539,8 @@ define(function (require, exports, module) {
hints;
if (type.property) {
var ternHints = ScopeManager.getTernHints("dir", "file", offset, this.editor.document.getText());
var ternHints = this.ternHints;
//console.log("Got " + (ternHints ? ternHints.length : 0) + " hints from tern");
if( ternHints && ternHints.length > 0 ) {
hints = ternHints;
}
@@ -565,6 +567,9 @@ define(function (require, exports, module) {
return hints;
};
Session.prototype.setTernHints = function(newHints) {
this.ternHints = newHints;
}
module.exports = Session;
});