import { updateUserKeybindings } from '@codingame/monaco-vscode-keybindings-service-override';

async function updateKeybindings(bindingsJson) {
    await updateUserKeybindings(bindingsJson);
}
class PromiseDisposable {
    constructor(promise) {
        this.promise = promise;
    }
    dispose() {
        this.promise.then(disposable => disposable.dispose(), console.error);
    }
}
function updateEditorKeybindingsMode(editor, keyBindingsMode = 'classic', statusBarElement) {
    switch (keyBindingsMode) {
        case 'vim': {
            return new PromiseDisposable(import('./vim.js').then(module => module).then(({ initVimMode }) => {
                return initVimMode(editor, statusBarElement);
            }));
        }
        case 'emacs': {
            return new PromiseDisposable(import('../node_modules/monaco-emacs/lib/index.js').then(module => module).then(function (n) { return n.i; }).then(({ default: EmacsExtension }) => {
                const emacsExtension = new EmacsExtension(editor);
                emacsExtension.start();
                return emacsExtension;
            }));
        }
        default: {
            return {
                dispose: () => { }
            };
        }
    }
}

export { updateEditorKeybindingsMode, updateKeybindings };
