Vinnecent
unread,Oct 29, 2024, 10:19:46 AM10/29/24Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ajax.org Cloud9 Editor (Ace)
The problem I want to solve is this. I habe a completion "app.doc.pages[i].inks[j].name" and want to be able to get completions even if I write something like this "app.doc.pages[0]". I looked all over for a solution for this problem but have not found anything that would help.
The exactMatch bool does not help in this case as well. My ultimate goal would be to allow anything inside the square brackets and still get the correct completions.
Help would be much appreciated.
Small code example:
const langTools = ace.require("ace/ext/language_tools");
const customCompleter = {
triggerCharacters: ['.'],
identifierRegexps: [/[a-zA-Z_0-9\.\$\[\]\-\u00A2-\u2000\u2070-\uFFFF]/],
getCompletions: function(editor, session, pos, prefix, callback) {
const completions = [
{
"caption": "app.doc.pages[i].inks[j].name",
"meta": "example",
"value": "app.doc.pages[i].inks[j].name"
},
{
"caption": "app.doc.title",
"meta": "example",
"value": "app.doc.title"
}
];
callback(null, completions);
}
};
langTools.addCompleter(customCompleter);
const editor = ace.edit("editor");
editor.setOptions({
enableBasicAutocompletion: true,
enableLiveAutocompletion: true
});