Bug fixes
This commit is contained in:
parent
ea532e41bf
commit
3c13b4bf33
1 changed files with 77070 additions and 77056 deletions
|
|
@ -988,8 +988,6 @@ var TreeOps = _dereq_('../tree_ops').TreeOps;
|
||||||
var ID_REGEX = /[a-zA-Z_0-9\$]/;
|
var ID_REGEX = /[a-zA-Z_0-9\$]/;
|
||||||
|
|
||||||
function retrievePrecedingIdentifier(text, pos, regex) {
|
function retrievePrecedingIdentifier(text, pos, regex) {
|
||||||
console.log(text);
|
|
||||||
console.log(pos);
|
|
||||||
regex = regex || ID_REGEX;
|
regex = regex || ID_REGEX;
|
||||||
var buf = [];
|
var buf = [];
|
||||||
for (var i = pos-1; i >= 0; i--) {
|
for (var i = pos-1; i >= 0; i--) {
|
||||||
|
|
@ -1041,6 +1039,24 @@ var nameChar = '[' + char + ']';
|
||||||
var nameCharRegExp = new RegExp(nameChar);
|
var nameCharRegExp = new RegExp(nameChar);
|
||||||
//var varCharRegExp = new RegExp(varChar);
|
//var varCharRegExp = new RegExp(varChar);
|
||||||
|
|
||||||
|
var varDeclLabels = {
|
||||||
|
'LetBinding': 'Let binding',
|
||||||
|
'Param': 'Function parameter',
|
||||||
|
'QuantifiedExpr': 'Quantified expression binding',
|
||||||
|
'VarDeclStatement': 'Local variable',
|
||||||
|
'ForBinding': 'For binding',
|
||||||
|
'TumblingWindowClause': 'Tumbling window binding',
|
||||||
|
'WindowVars': 'Window variable',
|
||||||
|
'SlidingWindowClause': 'Sliding window binding',
|
||||||
|
'PositionalVar': 'Positional variable',
|
||||||
|
'CurrentItem': 'Current item',
|
||||||
|
'PreviousItem': 'Previous item',
|
||||||
|
'NextItem': 'Next item',
|
||||||
|
'CountClause': 'Count binding',
|
||||||
|
'GroupingVariable': 'Grouping variable',
|
||||||
|
'VarDecl': 'Module variable'
|
||||||
|
};
|
||||||
|
|
||||||
var findCompletions = function(prefix, allIdentifiers) {
|
var findCompletions = function(prefix, allIdentifiers) {
|
||||||
allIdentifiers.sort();
|
allIdentifiers.sort();
|
||||||
var startIdx = prefixBinarySearch(allIdentifiers, prefix);
|
var startIdx = prefixBinarySearch(allIdentifiers, prefix);
|
||||||
|
|
@ -1066,7 +1082,6 @@ var completePrefix = function(identifier, pos, sctx){
|
||||||
var match = function(name) {
|
var match = function(name) {
|
||||||
return {
|
return {
|
||||||
name: name + ':',
|
name: name + ':',
|
||||||
score: 8,
|
|
||||||
value: name + ':'
|
value: name + ':'
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -1105,7 +1120,6 @@ var completeFunction = function(identifier, pos, sctx){
|
||||||
var match = function(name) {
|
var match = function(name) {
|
||||||
return {
|
return {
|
||||||
name: name,
|
name: name,
|
||||||
score: 4,
|
|
||||||
value: name
|
value: name
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -1123,14 +1137,17 @@ var completeVariable = function(identifier, pos, sctx){
|
||||||
}
|
}
|
||||||
var decls = sctx.getVariables();
|
var decls = sctx.getVariables();
|
||||||
var names = [];
|
var names = [];
|
||||||
|
var types = {};
|
||||||
Object.keys(decls).forEach(function(key){
|
Object.keys(decls).forEach(function(key){
|
||||||
var i = key.indexOf('#');
|
var i = key.indexOf('#');
|
||||||
var ns = key.substring(0, i);
|
var ns = key.substring(0, i);
|
||||||
var name = key.substring(i+1);
|
var name = key.substring(i+1);
|
||||||
if(ns !== ''){
|
if(ns !== ''){
|
||||||
names.push(sctx.getPrefixByNamespace(ns) + ':' + name);
|
names.push(sctx.getPrefixByNamespace(ns) + ':' + name);
|
||||||
|
types[sctx.getPrefixByNamespace(ns) + ':' + name] = decls[key].type;
|
||||||
} else {
|
} else {
|
||||||
names.push(name);
|
names.push(name);
|
||||||
|
types[name] = decls[key].type;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1138,17 +1155,14 @@ var completeVariable = function(identifier, pos, sctx){
|
||||||
var match = function(name) {
|
var match = function(name) {
|
||||||
return {
|
return {
|
||||||
name: '$' + name,
|
name: '$' + name,
|
||||||
score: 4,
|
value: '$' + name,
|
||||||
value: '$' + name
|
meta: varDeclLabels[types[name]]
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
return matches.map(match);
|
return matches.map(match);
|
||||||
};
|
};
|
||||||
|
|
||||||
var completeExpr = function(line, pos, sctx){
|
var completeExpr = function(line, pos, sctx){
|
||||||
console.log('line');
|
|
||||||
console.log(line);
|
|
||||||
console.log('=');
|
|
||||||
var identifier = retrievePrecedingIdentifier(line, pos.col, nameCharRegExp);
|
var identifier = retrievePrecedingIdentifier(line, pos.col, nameCharRegExp);
|
||||||
var before = line.substring(0, pos.col - (identifier.length === 0 ? 0 : identifier.length));
|
var before = line.substring(0, pos.col - (identifier.length === 0 ? 0 : identifier.length));
|
||||||
var isVar = before[before.length - 1] === '$';
|
var isVar = before[before.length - 1] === '$';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue