ace.require("ace/ext/language_tools"); //To allow autocompletion
var editor = ace.edit("editor", {
  enableBasicAutocompletion: true,
  enableLiveAutocompletion: true,
  theme: "ace/theme/chrome",
  mode: "ace/mode/html",
  fontSize: "14px",
  showPrintMargin: false,
  useWorker: false // Disable web worker for this simple demo
});

//ace.require('ace/ext/settings_menu');
editor.setTheme("ace/theme/github");
//editor.session.setMode("ace/mode/html");
editor.commands.addCommands([
  {
    name: "showSettingsMenu",
    bindKey: {
      win: "Ctrl-q",
      mac: "Ctrl-q"
    },
    exec: function (editor) {
      editor.showSettingsMenu();
    },
    readOnly: true
  }
]);
var provider = LanguageProvider.fromCdn("https://www.unpkg.com/ace-linters@latest/build/");
provider.registerEditor(editor);

const serverData = {
    module: () => import("https://www.unpkg.com/ace-linters@latest/build/language-client"),
    modes: "json|json5",
    type: "socket",
    socket: new WebSocket("ws://127.0.0.1:3000/ws/lsp"), // your websocket server address
}

function opts(editor) {
  const modes=editor.session.$modes;
  console.log(editor.session.$modeId);
  console.log(Object.keys(modes));
}