cache modifier

This commit is contained in:
sevin7676 2015-04-19 11:52:54 -04:00
commit 1027dcea7c

View file

@ -218,26 +218,30 @@ var SqlServerHighlightRules = function() {
builtinFunctions = builtinFunctions.split('|');
dataTypes = dataTypes.split('|');
var modCache = {};
this.completionModifier = function(obj) {
var word = obj.name,
meta = 'keyword';
if (builtInStoredProcedures.indexOf(word) !== -1) meta = "storedProcedure";
else {
//all others are upper case
word = word.toUpperCase();
if (builtinFunctions.indexOf(word) !== -1) meta = "function";
else if (dataTypes.indexOf(word) !== -1) meta = "dataType";
else if (setStatements.indexOf(word) !== -1) meta = "setStatement";
else if (logicalOperators.indexOf(word) !== -1) meta = "logicalOperator";
if (modCache[word] === undefined) {
if (builtInStoredProcedures.indexOf(word) !== -1) meta = "storedProcedure";
else {
//all others are upper case
word = word.toUpperCase();
if (builtinFunctions.indexOf(word) !== -1) meta = "function";
else if (dataTypes.indexOf(word) !== -1) meta = "dataType";
else if (setStatements.indexOf(word) !== -1) meta = "setStatement";
else if (logicalOperators.indexOf(word) !== -1) meta = "logicalOperator";
}
modCache[word] = {
word: word,
value: word,
meta: meta,
score: 0
};
}
return {
name: word,
value: word,
score: 0,
meta: meta
};
return modCache[word];
};
};