I am trying to get codemirrors show hint functionality to work I have managed to get it to work with extraKeys this loads the getHints function fine but I really want it to work with onKeyEvent but this doesn't seem to do anything I can't even get it to send an alert message
function getHints(cm) {
// find the words
}
$(document).ready(function(){
CodeMirror.registerHelper("hint", "logger", getHints);
CodeMirror.commands.autocomplete = function(cm) {
cm.showHint({hint: CodeMirror.hint.logger});
}
var editor = CodeMirror.fromTextArea(
$("#log").get(0),
{
extraKeys: {"Ctrl": "autocomplete"},
onKeyEvent: function(e, s) {
var kc = s.keyCode;
if (s.type == "keyup") {
if (kc != 38 && kc != 40 && kc != 13 && kc != 27 && kc != 32) {
alert(kc);
CodeMirror.commands.autocomplete(e);
}
}
}
});
});
Heres what I was playing with I have no idea what I am doing wrong even trying to use jquerys trigger doesnt seem to do anything :/ http://jsfiddle.net/f2n74k3s/7/