title: CodeMirror - AutoComplete "options" not setting right
body: <p>I am using <code>CodeMirror</code> and attempting to do some CSS styling to the autocomplete pop up. This is a bit difficult, because I need it to not go away when I go to inspect styles and stuff.</p>
  
  <p>So I hunted for a way to do this. I found this code in <code>show-hint.js</code> </p>
  
  <pre><code>if (options.closeOnUnfocus !== false) {
      var closingOnBlur;
      cm.on("blur", this.onBlur = function () { closingOnBlur = setTimeout(function () { completion.close(); }, 100); });
      cm.on("focus", this.onFocus = function () { clearTimeout(closingOnBlur); });
  }
  </code></pre>
  
  <p>If I comment this out, then the autocomplete pop up does not go away when I click on other things; That's what I wanted. But I thought I would explore this more and try to determine what to do to toggle this on and off at will.</p>
  
  <p>So I wanted to be able to set this <code>closeOnUnfocus</code> option on my own. That seemed simple enough.</p>
  
  <p>I cannot find a way to do this, though. Exploring further I found an example on code mirror's website that demonstrates a way to setup the autocomplete system using the following code;</p>
  
  <pre><code>  CodeMirror.commands.autocomplete = function(cm) {
      CodeMirror.showHint(cm, CodeMirror.hint.anyword);
    }
  </code></pre>
  
  <p>Exploring further, <code>show-hint.js</code> starts out with a function called <code>showHint</code> that has this signature;</p>
  
  <pre><code>CodeMirror.showHint = function (cm, getHints, options) {
      // We want a single cursor position.
      if (cm.somethingSelected()) return;
      if (getHints == null) {
          if (options &amp;&amp; options.async) return;
          else getHints = CodeMirror.hint.auto;
      }
  
      if (cm.state.completionActive) cm.state.completionActive.close();
  
      var completion = cm.state.completionActive = new Completion(cm, getHints, options || {});
      CodeMirror.signal(cm, "startCompletion", cm);
      if (completion.options.async)
          getHints(cm, function (hints) { completion.showHints(hints); }, completion.options);
      else
          return completion.showHints(getHints(cm, completion.options));
  };
  </code></pre>
  
  <p>Okay, so it stands to reason that I could accomplish what I want by passing my option through here; like this...</p>
  
  <pre><code>CodeMirror.commands.autocomplete = function (cm) {
      CodeMirror.showHint(cm, CodeMirror.hint.anyword, {
          closeOnUnfocus: false
      });
  }
  </code></pre>
  
  <p>But this doesn't work - in fact, it seems that the options just don't get passed at all. If I do a <code>console.log</code> in the <code>show-hint.js</code>, the options are outright ignored. They never get through.</p>
  
  <p>So how can I pass options through? I am very confused.</p>