I managed to get asynchronous shutdown with CodeMirror 5.3 show-hint.js, using the following (es6 flavored, so for es3 replace leton varand =>on function)
While there is no real ajax, we hope, obviously, how to do this, just call the callbackajax call completion handler.
CodeMirror.registerHelper('hint', 'ajax', (mirror, callback) => {
let words = ['foo', 'bar', 'baz'];
let cur = mirror.getCursor();
let range = mirror.findWordAt(cur);
let fragment = mirror.getRange(range.anchor, range.head);
callback({
list: words.filter(w => w.indexOf(fragment) === 0),
from: range.anchor,
to: range.head
});
});
CodeMirror.hint.ajax.async = true;
CodeMirror.commands.autocomplete = function(mirror) {
mirror.showHint({ hint: CodeMirror.hint.ajax });
};
async, :
async true, (cm, callback,?), ,