I am trying to get the selected word when I do autocomplete on codemirror , this is my code it work when the autocomplete trigger by press “ctrl_space” ( I selected word from drop down list and the value of completion is the selected word )
extraKeys: {
"Ctrl-Space": "autocomplete",
"Ctrl-Space":function(cm){
CodeMirror.showHint(cm, CodeMirror.hint.anyword);
var completion = cm.state.completionActive.data;
alert(completion);
}
it work fine , But when I put the same code when I press “.” then the code not work (I selected word from drop down list but the value of completion is empty ) :
extraKeys: { "'.'": "autocomplete", "'.'":function(cm){ CodeMirror.showHint(cm, CodeMirror.hint.anyword); var completion = cm.state.completionActive.data; alert(completion); }
so what wrong ?