So i want to make an ide using monaco, for my programming language.
I am using Microsoft's Monaco API, for JavaScript.
Now here is the code:
window.addIntellisense = (function(lbl, instrText, kind) {
if(kind == "func") {
window.suggestions.push({label: new RegExp(lbl, ""), kind: monaco.languages.CompletionItemKind.Function, insertText: instrText})
console.log({label: new RegExp(lbl, ""), kind: monaco.languages.CompletionItemKind.Function, insertText: instrText})
window.setMonarch();
}else if(kind == "const") {
window.suggestions.push({label: new RegExp(lbl, ""), kind: monaco.languages.CompletionItemKind.Constant, insertText: instrText})
window.setMonarch();
}else {
console.error("kinderror")
}
})
The problem is when i use it, no errors as soon as i type one letter i get the error:
Uncaught Error: can't assign to property "range" on "[": not an object
Edit: Okay so instead of += i am now using push and now i get: Uncaught Error: this.textLabel is undefined