Dynamically switch mode with SQL hint addon bugs


I have a textarea with CodeMirror where the user can type SQL in different SQL syntaxes (by choosing using a button) for example MySQL, Oracle, Access and MSSQL. I have defined some new MIME types for this.
I also use the addon SQL Hint (which use/relies on addon Show Hint).
I can dynamically switch between the different syntaxes. When I then, for the first time, use the SQL hint by using CTRL-SPACE it works by showing me the correct SQL functions that belong to the current selected SQL syntax. But after that when I again change the SQL syntax and again invoke the SQL hint addon the dropdown still shows the SQL functions for the previous selected SQL syntax.

This is my code (I left out the MIME type defintion code):

    editor = CodeMirror.fromTextArea(document.getElementById("sqlCode"), {
      autofocus: true,
      mode: "text/x-ELO-mssql",
      indentWithTabs: true,
      smartIndent: true,
      lineNumbers: true,
      matchBrackets : true,
      readOnly: true,
      tabSize: 2,
      styleSelectedText: true,   //for the addon mark-selection.js
      extraKeys: {"Ctrl-Space": "autocomplete"}, // To invoke the auto complete
      hint: CodeMirror.hint.sql,
      hintOptions: {
          tables: {
              "bestelregel":  [ "bestelnr", "artcodelev", "aantal", "bestelprijs" ],
              "bestelling":   [ "bestelnr", "levcode", "besteldatum", "leverdatum", "bedrag" ],
              "leverancier":  [ "levcode", "levnaam", "levadres", "levwoonplaats" ],
              "offerte":      [ "levcode", "artcodelev", "plantcode", "levertijd", "offerteprijs" ],
              "plant":        [ "plantcode", "plantnaam", "soort", "kleur", "hoogte", "bloeitijd-start", "bloeitijd-einde", "prijs" ],
              "plantschema":  [ "categorie", "minimumhoogte", "maximumhoogte", "afstand" ]


  function changeEditorMode(){
    var mode="text/x-ELO-"+dbType;
    alert("calling changeEditorMode with mode '"+mode+"'");
    if (dbType=="") return;
    alert("setting changeEditorMode with mode '"+mode+"'");

I tested with the latest version v5.14.2.

greetings Jan

I think this patch will help.

Thanks it works now!