Plunker: http://plnkr.co/edit/bEkUM2?p=preview
Few notes on the plunk:
I am using the Javascript ACE editor to create a syntax highlighter for a language (DRL). I am attempting to use the autocomplete option.
ace.config.loadModule("ace/ext/language_tools", function() {
editor.setOptions({
enableSnippets: true,
enableBasicAutocompletion: true
});
});This feature recognizes my local variables but it fails to see my keywords defined in my syntax highlighter. I think I have tracked down the problem and it seems be that the session.$mode.$keywordList referenced in the ext-language_tools.js file (line #41) is empty when the script exectues.
var keyWordCompleter = {
getCompletions: function(editor, session, pos, prefix, callback) {
console.log(session.$mode.$keywordList);
var keywords = session.$mode.$keywordList || [];
keywords = keywords.filter(function(w) {
return w.lastIndexOf(prefix, 0) == 0;
});
callback(null, keywords.map(function(word) {
return {
name: word,
value: word,
score: 0,
meta: "keyword"
};
}));
}};
My syntax highlighter includes all keywords as a keyword mapper as follows...
var keywordMapper = this.createKeywordMapper({
"keyword" : "lock-on-active|date-effective|date-expires|no-loop|" +
"auto-focus|activation-group|agenda-group|ruleflow-group|" +
"entry-point|duration|package|import|dialect|salience|enabled|" +
"attributes|rule|extend|when|then|template|query|declare|" +
"function|global|eval|not|in|or|and|exists|forall|accumulate|" +
"collect|from|action|reverse|result|end|over|init"
},"identifier");So, how do I go about having the autocomplete feature in ACE recognize my keywords and not just local variables?