How I can to make on (oneclick) to Choose the word from my own autocomplete list on codemirror?


#1

I am using codemirror I do autocomlete to my own word and work fine the word which I Choose display on codemirror by one click on the word within the drop down list , my problem is when I use the function

(select) then I need to double click to Choose the word I want from drop down list … this is my code :
> extraKeys: {
> “Ctrl-Space”:function(cm){
> CodeMirror.showHint(cm, CodeMirror.hint.anyword);
> CodeMirror.on(completion, ‘select’, function(completion, element) {
> // do something in selected word
> })
> }

so any body can help me … How to make choose the word from drop down list by one click with

(select)
can I make the drop down list disappare after one one click ??? if I can not what I must to do ??


#2

I’m not sure what the select handler has to do with this (it seems out of place in the example code, where there is no completion variable around), but the compleSingle option to showHint should help here:

cm.showHint({hint: CodeMirror.hint.anyword, completeSingle: true})

#3

I try :
cm.showHint({hint: CodeMirror.hint.anyword, completeSingle: true})
But it did not work … I still must to do double click to chooes the word …I declear
var completion = cm.state.completionActive.data; to knew what selected word , and it work fine the completion has the value of selected word … But I did not knew how to make the chooes after one click … so
can I make the drop down list disappare after one click or in the end of function select ??? @marijn