try it by adding an input event listener to the div and if there is a keyword like void, then you could surround it with a span with a specific color.
Pls don't do this!!! This is a very big vulnerability because anyone can code for you.
But if you really need this, you can use this code:
document.querySelector(“.editor”).addEventListener(“input”, () => {
var content = document.querySelector(“.editor”).innerHTML;
var newContent = content.substr(0, content.search("void")) + "<span>void" + "</span>" + content.substr(content.search("void") + "void".length, content.length);
}, false);
Sry if its not working, I hate coding on phone...