fix bug where hints disappear on first character

This commit is contained in:
dloverin committed 2013-03-28 16:21:24 -04:00
1 parent 7bfaedfa0a
commit 7ac5459e6a
3 files changed
+7 -5

No files matched your search

@@ -350,6 +350,9 @@ define(function (require, exports, module) {
hints = ternHints;
hints.sort(compareByName);
}
else {
hints = [];
}
} else {
hints = ternHints ? ternHints : [];
hints.sort(compareIdentifiers());
@@ -311,7 +311,7 @@ define(function (require, exports, module) {
type.property !== cachedType.property ||
type.context !== cachedType.context ||
query.length == 0 ||
(cachedHints.length = 0 && query.length == 2)) { // FIXME: length of 2 is special because that is when tern starts guessing
(cachedHints.length == 0 && query.length == 2)) { // FIXME: length of 2 is special because that is when tern starts guessing
var offset = session.getOffset(),
scopeResponse = ScopeManager.getScopeInfo(session, session.editor.document, offset),
self = this;
@@ -351,8 +351,7 @@ define(function (require, exports, module) {
// Compute fresh hints if none exist, or if the session
// type has changed since the last hint computation
if (!cachedHints ||
type.property !== cachedType.property ||
if (type.property !== cachedType.property ||
type.context !== cachedType.context) {
cachedType = type;
cachedHints = session.getHints();
@@ -111,10 +111,10 @@ importScripts("thirdparty/requirejs/require.js");
}
var request = buildRequest(dir, file, "completions", offset);
//_log("request " + dir + " " + file + " " + offset /*+ " " + text */);
_log("request " + dir + " " + file + " " + offset /*+ " " + text */);
ternServer.request(request, function(error, data) {
//if (error) return displayError(error);
//_log("completions.length = " + data.completions.length);
_log("completions.length = " + data.completions.length);
var completions = [];
var ternHints = [];
for (var i = 0; i < data.completions.length; ++i) {