cache modifier
This commit is contained in:
parent
961f8c4893
commit
1027dcea7c
1 changed files with 20 additions and 16 deletions
|
|
@ -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];
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue