[editor] Limit background location checks to cached data only
If table data is not cached it will not verify the existence of any columns for that table
identifierChain: identifierChain,
defaultDatabase: self.snippet.database(),
silenceErrors: true,
- errorCallback: function (data) {
- promise.reject([]);
- },
+ cachedOnly: true,
successCallback: function (data) {
promise.resolve(data.extended_columns || data.tables_meta || []);
+ },
+ errorCallback: function () {
+ promise.reject([]);
}
});
return promise;
var self = this;
var promise = $.Deferred();
if (token.parseLocation.tables && token.parseLocation.tables.length > 0) {
- var tablePromisses = [];
+ var tablePromises = [];
token.parseLocation.tables.forEach(function (table) {
if (table.identifierChain) {
- tablePromisses.push(self.fetchAutocompleteDeferred(table.identifierChain));
+ tablePromises.push(self.fetchAutocompleteDeferred(table.identifierChain));
}
});
- $.when.apply($, tablePromisses).always(function () {
+ $.when.apply($, tablePromises).done(function () {
var joined = [];
for (var i = 0; i < arguments.length; i++) {
joined = joined.concat(arguments[i]);
}
promise.resolve(joined);
- });
+ }).fail(promise.reject);
} else if (token.parseLocation.identifierChain && token.parseLocation.identifierChain.length > 0) {
// fetch the parent
// TODO: Fetch the parents parent first to see if it actually exists to prevent a bunch of failing calls when
sourceType: self.snippet.type(),
defaultDatabase: self.snippet.database(),
identifierChain: nextTable.identifierChain,
+ cachedOnly: true,
silenceErrors: true,
successCallback: function (data) {
if (typeof data.columns !== 'undefined' && data.columns.indexOf(location.identifierChain[0].name.toLowerCase()) !== -1) {
}
verifyThrottle = window.setTimeout(verify, VERIFY_DELAY);
});
- })
+ }).fail(function () {
+ // Can happen when tables aren't cached etc.
+ verifyThrottle = window.setTimeout(verify, VERIFY_DELAY);
+ });
};
verifyThrottle = window.setTimeout(verify, VERIFY_DELAY);
