I am trying to add two different autocomplete list in ace-editor by using two different short cut keys. Ctrl-T should list only the tables and Ctrl-Space should list specific keywords as well as the tables. Please any one could help me with this as I am new to ace-editor
You can update the wordList upon different Shortcut keys and update the autocomplete. Ctrl-Space is used by the ace to trigger the basic auto-completer to come up. I would suggest you use any other shortcut for making a new autocompletion.
editor.commands.addCommand({
name: "myCommand2",
bindKey: { win: "Ctrl-T", mac: "Cmd-T" },
exec: function () {
//Update the Worldlist with tables here and make a call for the autocomplete
wordList=['table1','table2']; //set of table names
}
});
Similarly, you can bind the other short cut and update the wordList for the autocomplete
var staticWordCompleter = {
getCompletions: function(editor, session, pos, prefix, callback) {
callback(null, wordList.map(function(word) {
return {
caption: word,
value: word,
meta: "static"
};
}));
}
}