I want to do autocomplete when I press the character “.” so I write :
CodeMirror.commands.autocomplete = function(cm) {
CodeMirror.showHint(cm, CodeMirror.hint.anyword);
};
var editor = CodeMirror.fromTextArea(document.getElementById("area"), {
lineNumbers: true,
"'.'": "autocomplete",
"'.'" : function(cm) {
setTimeout(function(){cm.execCommand("autocomplete");}, 10);
throw CodeMirror.Pass; // tell CodeMirror we didn't handle the key
CodeMirror.showHint(cm, CodeMirror.hint.anyword); // I try to add it and remove this instraction but the same result
},
the autocomplete work fine when I press “.” … but sometime the autocomplete not trigger when I press “.” (when that happen I remove the “.” and type “.” again then autocomplete work ) so My question Why sometime the autocomplete not work when I type “.” ? and in this case Why when I remove the “.” and type it again it work ?