Skip to content

Commit

Permalink
fixed #35 dissociate display string from the actual string inserted f…
Browse files Browse the repository at this point in the history
…rom content assist
  • Loading branch information
Amine Lajmi committed Dec 10, 2016
1 parent 3100013 commit c6f6145
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 387 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @Generated by DSLFORGE
* @Generated by DSL Forge
*/
//minify using as YUI Compressor, Google Closure Compiler, or JSMin.
(function() {
Expand Down Expand Up @@ -95,7 +95,7 @@
} else {
//Compute worker's http URL
var filePath = 'rwt-resources/src-js/org/dslforge/styledtext/global-index.js';
var httpURL = computeWorkerPath(filePath);
var httpURL = this.computeWorkerPath(filePath);
var worker = this.worker = new SharedWorker(httpURL);
if (this.ready) {
editor.on("change", function(event) {
Expand Down Expand Up @@ -179,23 +179,7 @@
},

onCompletionRequest : function(pos, prefix, callback) {
if (this.isFocused) {
var remoteObject = rap.getRemoteObject(this);
if (remoteObject) {
remoteObject.call("getProposals", { value : this.editor.getValue(), pos : pos, prefix : prefix});
}
var proposals = this.proposals==null?[":"]:this.proposals;
var wordList = Object.keys(proposals);
callback(null, wordList.map(function(word) {
return {
iconClass: " " + typeToIcon(proposals[word].split(":")[1]),
name: word,
value: proposals[word].split(":")[0],
score: 1,
meta: "[" + proposals[word].split(":")[1] + "]"
};
}));
}
this.base(arguments, pos, prefix, callback);
},

setProposals : function(proposals) {
Expand Down Expand Up @@ -228,26 +212,4 @@
}
});

var computeWorkerPath = function (path) {
path = path.replace(/^[a-z]+:\/\/[^\/]+/, "");
path = location.protocol + "//" + location.host
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
+ "/" + path.replace(/^[\/]+/, "");
return path;
};

var typeToIcon = function(type) {
var cls = "ace-";
var suffix;
if (type == "?") suffix = "unknown";
else if (type == "keyword") suffix = type;
else if (type == "identifier") suffix = type;
else if (type == "snippet") suffix = "snippet";
else if (type == "number" || type == "string" || type == "bool") suffix = type;
else if (/^fn\(/.test(type)) suffix = "fn";
else if (/^\[/.test(type)) suffix = "array";
else suffix = "object";
return cls + "completion " + cls + "completion-" + suffix;
};

}());
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @Generated by DSLFORGE
* @Generated by DSL Forge
*/
//minify using as YUI Compressor, Google Closure Compiler, or JSMin.
(function() {
Expand Down Expand Up @@ -95,7 +95,7 @@
} else {
//Compute worker's http URL
var filePath = 'rwt-resources/src-js/org/dslforge/styledtext/global-index.js';
var httpURL = computeWorkerPath(filePath);
var httpURL = this.computeWorkerPath(filePath);
var worker = this.worker = new SharedWorker(httpURL);
if (this.ready) {
editor.on("change", function(event) {
Expand Down Expand Up @@ -179,23 +179,7 @@
},

onCompletionRequest : function(pos, prefix, callback) {
if (this.isFocused) {
var remoteObject = rap.getRemoteObject(this);
if (remoteObject) {
remoteObject.call("getProposals", { value : this.editor.getValue(), pos : pos, prefix : prefix});
}
var proposals = this.proposals==null?[":"]:this.proposals;
var wordList = Object.keys(proposals);
callback(null, wordList.map(function(word) {
return {
iconClass: " " + typeToIcon(proposals[word].split(":")[1]),
name: word,
value: proposals[word].split(":")[0],
score: 1,
meta: "[" + proposals[word].split(":")[1] + "]"
};
}));
}
this.base(arguments, pos, prefix, callback);
},

setProposals : function(proposals) {
Expand Down Expand Up @@ -228,26 +212,4 @@
}
});

var computeWorkerPath = function (path) {
path = path.replace(/^[a-z]+:\/\/[^\/]+/, "");
path = location.protocol + "//" + location.host
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
+ "/" + path.replace(/^[\/]+/, "");
return path;
};

var typeToIcon = function(type) {
var cls = "ace-";
var suffix;
if (type == "?") suffix = "unknown";
else if (type == "keyword") suffix = type;
else if (type == "identifier") suffix = type;
else if (type == "snippet") suffix = "snippet";
else if (type == "number" || type == "string" || type == "bool") suffix = type;
else if (/^fn\(/.test(type)) suffix = "fn";
else if (/^\[/.test(type)) suffix = "array";
else suffix = "object";
return cls + "completion " + cls + "completion-" + suffix;
};

}());
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @Generated by DSLFORGE
* @Generated by DSL Forge
*/
//minify using as YUI Compressor, Google Closure Compiler, or JSMin.
(function() {
Expand Down Expand Up @@ -95,7 +95,7 @@
} else {
//Compute worker's http URL
var filePath = 'rwt-resources/src-js/org/dslforge/styledtext/global-index.js';
var httpURL = computeWorkerPath(filePath);
var httpURL = this.computeWorkerPath(filePath);
var worker = this.worker = new SharedWorker(httpURL);
if (this.ready) {
editor.on("change", function(event) {
Expand Down Expand Up @@ -179,23 +179,7 @@
},

onCompletionRequest : function(pos, prefix, callback) {
if (this.isFocused) {
var remoteObject = rap.getRemoteObject(this);
if (remoteObject) {
remoteObject.call("getProposals", { value : this.editor.getValue(), pos : pos, prefix : prefix});
}
var proposals = this.proposals==null?[":"]:this.proposals;
var wordList = Object.keys(proposals);
callback(null, wordList.map(function(word) {
return {
iconClass: " " + typeToIcon(proposals[word].split(":")[1]),
name: word,
value: proposals[word].split(":")[0],
score: 1,
meta: "[" + proposals[word].split(":")[1] + "]"
};
}));
}
this.base(arguments, pos, prefix, callback);
},

setProposals : function(proposals) {
Expand Down Expand Up @@ -228,26 +212,4 @@
}
});

var computeWorkerPath = function (path) {
path = path.replace(/^[a-z]+:\/\/[^\/]+/, "");
path = location.protocol + "//" + location.host
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
+ "/" + path.replace(/^[\/]+/, "");
return path;
};

var typeToIcon = function(type) {
var cls = "ace-";
var suffix;
if (type == "?") suffix = "unknown";
else if (type == "keyword") suffix = type;
else if (type == "identifier") suffix = type;
else if (type == "snippet") suffix = "snippet";
else if (type == "number" || type == "string" || type == "bool") suffix = type;
else if (/^fn\(/.test(type)) suffix = "fn";
else if (/^\[/.test(type)) suffix = "array";
else suffix = "object";
return cls + "completion " + cls + "completion-" + suffix;
};

}());
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @Generated by DSLFORGE
* @Generated by DSL Forge
*/
//minify using as YUI Compressor, Google Closure Compiler, or JSMin.
(function() {
Expand Down Expand Up @@ -95,7 +95,7 @@
} else {
//Compute worker's http URL
var filePath = 'rwt-resources/src-js/org/dslforge/styledtext/global-index.js';
var httpURL = computeWorkerPath(filePath);
var httpURL = this.computeWorkerPath(filePath);
var worker = this.worker = new SharedWorker(httpURL);
if (this.ready) {
editor.on("change", function(event) {
Expand Down Expand Up @@ -179,23 +179,7 @@
},

onCompletionRequest : function(pos, prefix, callback) {
if (this.isFocused) {
var remoteObject = rap.getRemoteObject(this);
if (remoteObject) {
remoteObject.call("getProposals", { value : this.editor.getValue(), pos : pos, prefix : prefix});
}
var proposals = this.proposals==null?[":"]:this.proposals;
var wordList = Object.keys(proposals);
callback(null, wordList.map(function(word) {
return {
iconClass: " " + typeToIcon(proposals[word].split(":")[1]),
name: word,
value: proposals[word].split(":")[0],
score: 1,
meta: "[" + proposals[word].split(":")[1] + "]"
};
}));
}
this.base(arguments, pos, prefix, callback);
},

setProposals : function(proposals) {
Expand Down Expand Up @@ -227,27 +211,5 @@
}
}
});

var computeWorkerPath = function (path) {
path = path.replace(/^[a-z]+:\/\/[^\/]+/, "");
path = location.protocol + "//" + location.host
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
+ "/" + path.replace(/^[\/]+/, "");
return path;
};

var typeToIcon = function(type) {
var cls = "ace-";
var suffix;
if (type == "?") suffix = "unknown";
else if (type == "keyword") suffix = type;
else if (type == "identifier") suffix = type;
else if (type == "snippet") suffix = "snippet";
else if (type == "number" || type == "string" || type == "bool") suffix = type;
else if (/^fn\(/.test(type)) suffix = "fn";
else if (/^\[/.test(type)) suffix = "array";
else suffix = "object";
return cls + "completion " + cls + "completion-" + suffix;
};


}());
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @Generated by DSLFORGE
* @Generated by DSL Forge
*/
//minify using as YUI Compressor, Google Closure Compiler, or JSMin.
(function() {
Expand Down Expand Up @@ -95,7 +95,7 @@
} else {
//Compute worker's http URL
var filePath = 'rwt-resources/src-js/org/dslforge/styledtext/global-index.js';
var httpURL = computeWorkerPath(filePath);
var httpURL = this.computeWorkerPath(filePath);
var worker = this.worker = new SharedWorker(httpURL);
if (this.ready) {
editor.on("change", function(event) {
Expand Down Expand Up @@ -179,25 +179,9 @@
},

onCompletionRequest : function(pos, prefix, callback) {
if (this.isFocused) {
var remoteObject = rap.getRemoteObject(this);
if (remoteObject) {
remoteObject.call("getProposals", { value : this.editor.getValue(), pos : pos, prefix : prefix});
}
var proposals = this.proposals==null?[":"]:this.proposals;
var wordList = Object.keys(proposals);
callback(null, wordList.map(function(word) {
return {
iconClass: " " + typeToIcon(proposals[word].split(":")[1]),
name: word,
value: proposals[word].split(":")[0],
score: 1,
meta: "[" + proposals[word].split(":")[1] + "]"
};
}));
}
this.base(arguments, pos, prefix, callback);
},

setProposals : function(proposals) {
this.proposals = proposals;
},
Expand Down Expand Up @@ -227,27 +211,5 @@
}
}
});

var computeWorkerPath = function (path) {
path = path.replace(/^[a-z]+:\/\/[^\/]+/, "");
path = location.protocol + "//" + location.host
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
+ "/" + path.replace(/^[\/]+/, "");
return path;
};

var typeToIcon = function(type) {
var cls = "ace-";
var suffix;
if (type == "?") suffix = "unknown";
else if (type == "keyword") suffix = type;
else if (type == "identifier") suffix = type;
else if (type == "snippet") suffix = "snippet";
else if (type == "number" || type == "string" || type == "bool") suffix = type;
else if (/^fn\(/.test(type)) suffix = "fn";
else if (/^\[/.test(type)) suffix = "array";
else suffix = "object";
return cls + "completion " + cls + "completion-" + suffix;
};


}());

0 comments on commit c6f6145

Please sign in to comment.