SQL Hint completion problems

I have two problems while using SQL Hint completion:

  1. I want to automatically select the last remaining completion item so I used completeSingle: true in my hintOptions object that I pass to editor.setOption(“hintOptions”,hintOptions);
    But it doesn’t seem to work. I still have to type the complete word.

  2. I want to always show the dropdown while typing so I used this:

    editor.on('keypress', function(cm,e){

Strange thing is completeSingle now works but the last character I was typing is added after completion. So I have typed cou, now the last item COUNT in the dropdown remains. When I now type n this item automatically gets choosen (like I wanted/expected since I have set completeSingle option) but the n is added after COUNT like this: COUNTn.

What am I doing wrong? Or is this a bug?

Keypress handlers fire before the letter is actually typed, so if you run showHint this way it’ll take effect, and then the character is inserted, which is not what you want. You could add a timeout or use CodeMirror’s inputRead event.