Skip to content

Commit c6f6145

Browse files
committed
fixed #35 dissociate display string from the actual string inserted from content assist
1 parent 3100013 commit c6f6145

16 files changed

Lines changed: 100 additions & 387 deletions

File tree

examples/org.codingpark.piraterobot.play.web/src-js/org/codingpark/piraterobot/play/web/Play.js

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @Generated by DSLFORGE
2+
* @Generated by DSL Forge
33
*/
44
//minify using as YUI Compressor, Google Closure Compiler, or JSMin.
55
(function() {
@@ -95,7 +95,7 @@
9595
} else {
9696
//Compute worker's http URL
9797
var filePath = 'rwt-resources/src-js/org/dslforge/styledtext/global-index.js';
98-
var httpURL = computeWorkerPath(filePath);
98+
var httpURL = this.computeWorkerPath(filePath);
9999
var worker = this.worker = new SharedWorker(httpURL);
100100
if (this.ready) {
101101
editor.on("change", function(event) {
@@ -179,23 +179,7 @@
179179
},
180180

181181
onCompletionRequest : function(pos, prefix, callback) {
182-
if (this.isFocused) {
183-
var remoteObject = rap.getRemoteObject(this);
184-
if (remoteObject) {
185-
remoteObject.call("getProposals", { value : this.editor.getValue(), pos : pos, prefix : prefix});
186-
}
187-
var proposals = this.proposals==null?[":"]:this.proposals;
188-
var wordList = Object.keys(proposals);
189-
callback(null, wordList.map(function(word) {
190-
return {
191-
iconClass: " " + typeToIcon(proposals[word].split(":")[1]),
192-
name: word,
193-
value: proposals[word].split(":")[0],
194-
score: 1,
195-
meta: "[" + proposals[word].split(":")[1] + "]"
196-
};
197-
}));
198-
}
182+
this.base(arguments, pos, prefix, callback);
199183
},
200184

201185
setProposals : function(proposals) {
@@ -228,26 +212,4 @@
228212
}
229213
});
230214

231-
var computeWorkerPath = function (path) {
232-
path = path.replace(/^[a-z]+:\/\/[^\/]+/, "");
233-
path = location.protocol + "//" + location.host
234-
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
235-
+ "/" + path.replace(/^[\/]+/, "");
236-
return path;
237-
};
238-
239-
var typeToIcon = function(type) {
240-
var cls = "ace-";
241-
var suffix;
242-
if (type == "?") suffix = "unknown";
243-
else if (type == "keyword") suffix = type;
244-
else if (type == "identifier") suffix = type;
245-
else if (type == "snippet") suffix = "snippet";
246-
else if (type == "number" || type == "string" || type == "bool") suffix = type;
247-
else if (/^fn\(/.test(type)) suffix = "fn";
248-
else if (/^\[/.test(type)) suffix = "array";
249-
else suffix = "object";
250-
return cls + "completion " + cls + "completion-" + suffix;
251-
};
252-
253215
}());

examples/org.eclipse.sphinx.examples.xtext.hummingbird.web/src-js/org/eclipse/sphinx/examples/xtext/hummingbird/web/Hummingbird.js

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @Generated by DSLFORGE
2+
* @Generated by DSL Forge
33
*/
44
//minify using as YUI Compressor, Google Closure Compiler, or JSMin.
55
(function() {
@@ -95,7 +95,7 @@
9595
} else {
9696
//Compute worker's http URL
9797
var filePath = 'rwt-resources/src-js/org/dslforge/styledtext/global-index.js';
98-
var httpURL = computeWorkerPath(filePath);
98+
var httpURL = this.computeWorkerPath(filePath);
9999
var worker = this.worker = new SharedWorker(httpURL);
100100
if (this.ready) {
101101
editor.on("change", function(event) {
@@ -179,23 +179,7 @@
179179
},
180180

181181
onCompletionRequest : function(pos, prefix, callback) {
182-
if (this.isFocused) {
183-
var remoteObject = rap.getRemoteObject(this);
184-
if (remoteObject) {
185-
remoteObject.call("getProposals", { value : this.editor.getValue(), pos : pos, prefix : prefix});
186-
}
187-
var proposals = this.proposals==null?[":"]:this.proposals;
188-
var wordList = Object.keys(proposals);
189-
callback(null, wordList.map(function(word) {
190-
return {
191-
iconClass: " " + typeToIcon(proposals[word].split(":")[1]),
192-
name: word,
193-
value: proposals[word].split(":")[0],
194-
score: 1,
195-
meta: "[" + proposals[word].split(":")[1] + "]"
196-
};
197-
}));
198-
}
182+
this.base(arguments, pos, prefix, callback);
199183
},
200184

201185
setProposals : function(proposals) {
@@ -228,26 +212,4 @@
228212
}
229213
});
230214

231-
var computeWorkerPath = function (path) {
232-
path = path.replace(/^[a-z]+:\/\/[^\/]+/, "");
233-
path = location.protocol + "//" + location.host
234-
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
235-
+ "/" + path.replace(/^[\/]+/, "");
236-
return path;
237-
};
238-
239-
var typeToIcon = function(type) {
240-
var cls = "ace-";
241-
var suffix;
242-
if (type == "?") suffix = "unknown";
243-
else if (type == "keyword") suffix = type;
244-
else if (type == "identifier") suffix = type;
245-
else if (type == "snippet") suffix = "snippet";
246-
else if (type == "number" || type == "string" || type == "bool") suffix = type;
247-
else if (/^fn\(/.test(type)) suffix = "fn";
248-
else if (/^\[/.test(type)) suffix = "array";
249-
else suffix = "object";
250-
return cls + "completion " + cls + "completion-" + suffix;
251-
};
252-
253215
}());

examples/org.eclipse.xtext.example.arithmetics.web/src-js/org/eclipse/xtext/example/arithmetics/web/Arithmetics.js

Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @Generated by DSLFORGE
2+
* @Generated by DSL Forge
33
*/
44
//minify using as YUI Compressor, Google Closure Compiler, or JSMin.
55
(function() {
@@ -95,7 +95,7 @@
9595
} else {
9696
//Compute worker's http URL
9797
var filePath = 'rwt-resources/src-js/org/dslforge/styledtext/global-index.js';
98-
var httpURL = computeWorkerPath(filePath);
98+
var httpURL = this.computeWorkerPath(filePath);
9999
var worker = this.worker = new SharedWorker(httpURL);
100100
if (this.ready) {
101101
editor.on("change", function(event) {
@@ -179,23 +179,7 @@
179179
},
180180

181181
onCompletionRequest : function(pos, prefix, callback) {
182-
if (this.isFocused) {
183-
var remoteObject = rap.getRemoteObject(this);
184-
if (remoteObject) {
185-
remoteObject.call("getProposals", { value : this.editor.getValue(), pos : pos, prefix : prefix});
186-
}
187-
var proposals = this.proposals==null?[":"]:this.proposals;
188-
var wordList = Object.keys(proposals);
189-
callback(null, wordList.map(function(word) {
190-
return {
191-
iconClass: " " + typeToIcon(proposals[word].split(":")[1]),
192-
name: word,
193-
value: proposals[word].split(":")[0],
194-
score: 1,
195-
meta: "[" + proposals[word].split(":")[1] + "]"
196-
};
197-
}));
198-
}
182+
this.base(arguments, pos, prefix, callback);
199183
},
200184

201185
setProposals : function(proposals) {
@@ -228,26 +212,4 @@
228212
}
229213
});
230214

231-
var computeWorkerPath = function (path) {
232-
path = path.replace(/^[a-z]+:\/\/[^\/]+/, "");
233-
path = location.protocol + "//" + location.host
234-
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
235-
+ "/" + path.replace(/^[\/]+/, "");
236-
return path;
237-
};
238-
239-
var typeToIcon = function(type) {
240-
var cls = "ace-";
241-
var suffix;
242-
if (type == "?") suffix = "unknown";
243-
else if (type == "keyword") suffix = type;
244-
else if (type == "identifier") suffix = type;
245-
else if (type == "snippet") suffix = "snippet";
246-
else if (type == "number" || type == "string" || type == "bool") suffix = type;
247-
else if (/^fn\(/.test(type)) suffix = "fn";
248-
else if (/^\[/.test(type)) suffix = "array";
249-
else suffix = "object";
250-
return cls + "completion " + cls + "completion-" + suffix;
251-
};
252-
253215
}());

examples/org.eclipse.xtext.example.domainmodel.web/src-js/org/eclipse/xtext/example/domainmodel/web/Domainmodel.js

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @Generated by DSLFORGE
2+
* @Generated by DSL Forge
33
*/
44
//minify using as YUI Compressor, Google Closure Compiler, or JSMin.
55
(function() {
@@ -95,7 +95,7 @@
9595
} else {
9696
//Compute worker's http URL
9797
var filePath = 'rwt-resources/src-js/org/dslforge/styledtext/global-index.js';
98-
var httpURL = computeWorkerPath(filePath);
98+
var httpURL = this.computeWorkerPath(filePath);
9999
var worker = this.worker = new SharedWorker(httpURL);
100100
if (this.ready) {
101101
editor.on("change", function(event) {
@@ -179,23 +179,7 @@
179179
},
180180

181181
onCompletionRequest : function(pos, prefix, callback) {
182-
if (this.isFocused) {
183-
var remoteObject = rap.getRemoteObject(this);
184-
if (remoteObject) {
185-
remoteObject.call("getProposals", { value : this.editor.getValue(), pos : pos, prefix : prefix});
186-
}
187-
var proposals = this.proposals==null?[":"]:this.proposals;
188-
var wordList = Object.keys(proposals);
189-
callback(null, wordList.map(function(word) {
190-
return {
191-
iconClass: " " + typeToIcon(proposals[word].split(":")[1]),
192-
name: word,
193-
value: proposals[word].split(":")[0],
194-
score: 1,
195-
meta: "[" + proposals[word].split(":")[1] + "]"
196-
};
197-
}));
198-
}
182+
this.base(arguments, pos, prefix, callback);
199183
},
200184

201185
setProposals : function(proposals) {
@@ -227,27 +211,5 @@
227211
}
228212
}
229213
});
230-
231-
var computeWorkerPath = function (path) {
232-
path = path.replace(/^[a-z]+:\/\/[^\/]+/, "");
233-
path = location.protocol + "//" + location.host
234-
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
235-
+ "/" + path.replace(/^[\/]+/, "");
236-
return path;
237-
};
238-
239-
var typeToIcon = function(type) {
240-
var cls = "ace-";
241-
var suffix;
242-
if (type == "?") suffix = "unknown";
243-
else if (type == "keyword") suffix = type;
244-
else if (type == "identifier") suffix = type;
245-
else if (type == "snippet") suffix = "snippet";
246-
else if (type == "number" || type == "string" || type == "bool") suffix = type;
247-
else if (/^fn\(/.test(type)) suffix = "fn";
248-
else if (/^\[/.test(type)) suffix = "array";
249-
else suffix = "object";
250-
return cls + "completion " + cls + "completion-" + suffix;
251-
};
252-
214+
253215
}());

examples/org.eclipse.xtext.example.fowlerdsl.web/src-js/org/eclipse/xtext/example/fowlerdsl/web/Statemachine.js

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @Generated by DSLFORGE
2+
* @Generated by DSL Forge
33
*/
44
//minify using as YUI Compressor, Google Closure Compiler, or JSMin.
55
(function() {
@@ -95,7 +95,7 @@
9595
} else {
9696
//Compute worker's http URL
9797
var filePath = 'rwt-resources/src-js/org/dslforge/styledtext/global-index.js';
98-
var httpURL = computeWorkerPath(filePath);
98+
var httpURL = this.computeWorkerPath(filePath);
9999
var worker = this.worker = new SharedWorker(httpURL);
100100
if (this.ready) {
101101
editor.on("change", function(event) {
@@ -179,25 +179,9 @@
179179
},
180180

181181
onCompletionRequest : function(pos, prefix, callback) {
182-
if (this.isFocused) {
183-
var remoteObject = rap.getRemoteObject(this);
184-
if (remoteObject) {
185-
remoteObject.call("getProposals", { value : this.editor.getValue(), pos : pos, prefix : prefix});
186-
}
187-
var proposals = this.proposals==null?[":"]:this.proposals;
188-
var wordList = Object.keys(proposals);
189-
callback(null, wordList.map(function(word) {
190-
return {
191-
iconClass: " " + typeToIcon(proposals[word].split(":")[1]),
192-
name: word,
193-
value: proposals[word].split(":")[0],
194-
score: 1,
195-
meta: "[" + proposals[word].split(":")[1] + "]"
196-
};
197-
}));
198-
}
182+
this.base(arguments, pos, prefix, callback);
199183
},
200-
184+
201185
setProposals : function(proposals) {
202186
this.proposals = proposals;
203187
},
@@ -227,27 +211,5 @@
227211
}
228212
}
229213
});
230-
231-
var computeWorkerPath = function (path) {
232-
path = path.replace(/^[a-z]+:\/\/[^\/]+/, "");
233-
path = location.protocol + "//" + location.host
234-
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
235-
+ "/" + path.replace(/^[\/]+/, "");
236-
return path;
237-
};
238-
239-
var typeToIcon = function(type) {
240-
var cls = "ace-";
241-
var suffix;
242-
if (type == "?") suffix = "unknown";
243-
else if (type == "keyword") suffix = type;
244-
else if (type == "identifier") suffix = type;
245-
else if (type == "snippet") suffix = "snippet";
246-
else if (type == "number" || type == "string" || type == "bool") suffix = type;
247-
else if (/^fn\(/.test(type)) suffix = "fn";
248-
else if (/^\[/.test(type)) suffix = "array";
249-
else suffix = "object";
250-
return cls + "completion " + cls + "completion-" + suffix;
251-
};
252-
214+
253215
}());

0 commit comments

Comments
 (0)