title: Codemirror 3 multiplexing modes using simpleHint
body: <p>So I'm trying to make an SCXML editor which is basically XML (state machine) with JavaScript blocks in it.  I'm close, but I'm having trouble adding hints.  It seems to boil down to I don't know the editing mode I'm in when it comes time to hint.  I've looked in the CodeMirror object for clues but I'm not seeing it.  I'm doing the multiplexing like so:</p>
  
  <pre><code>CodeMirror.defineMode("scxml", function (config) {
      return CodeMirror.multiplexingMode(
        CodeMirror.getMode(config, "text/xml"),
        {
            open: "&lt;script&gt;", close: "&lt;/script&gt;",
            mode: CodeMirror.getMode(config, "text/javascript"),
            delimStyle: "delimit"
        }
      );
  });
  
  editorXml = CodeMirror.fromTextArea(document.getElementById("editXmlFile"), {
      lineNumbers: true,
      mode: 'scxml',
      indentUnit: 4,
      autoCloseTags: true,
      matchBrackets: true,
      extraKeys: {
          "'&gt;'": function (cm) { cm.closeTag(cm, '&gt;'); },
          "'/'": function (cm) { cm.closeTag(cm, '/'); },
          "' '": function (cm) { CodeMirror.xmlHint(cm, ' '); },
          "'&lt;'": function (cm) { CodeMirror.xmlHint(cm, '&lt;'); },
          "Ctrl-Space": function (cm) { CodeMirror.xmlHint(cm, ''); }
      }
  });
  </code></pre>
  
  <p>Note in the <code>extraKeys</code> where the XML hinting is working, how do I get the JavaScript hinting in there?  From the JavaScript hinting help, it appears I'd do something along the lines of:</p>
  
  <pre><code>  CodeMirror.commands.autocomplete = function(cm) {
      CodeMirror.simpleHint(cm, CodeMirror.javascriptHint);
    }
  
    ... extraKeys: {"Ctrl-Space": "autocomplete"} ...
  </code></pre>
  
  <p>But either way, I need to know the mode I'm in (XML or JavaScript) to know to use <code>simpleHint</code> versus <code>xmlHint</code>.  Anyone know how this might be done?</p>
  
  <p>EDIT: <code>cm.getMode().name</code> and <code>cm.getOption('mode')</code> just return <code>scxml</code> when I'm in either section</p>
  
  <p>Thanks!</p>