I’ve used codemirror for some autocompletion in openEHR Explorer, which was not too hard to setup: openehr-explorer/src/lib/aql/codemirror-autocomplete.ts at main · platzhersh/openehr-explorer · GitHub
Feel free to take inspiration / copy. Maybe you even see some missing things. If the interest is big enough, I could see to share the whole editor as a npm package.
I guess you could use Aces completer API to add something similar in the ehrbase sandbox.