import { registerExtension, ExtensionHostKind } from '@codingame/monaco-vscode-api/extensions';

const { registerFileUrl, whenReady } = registerExtension({
    name: 'cobol-indent',
    publisher: 'codingame',
    version: '1.0.0',
    engines: {
        vscode: '*'
    },
    activationEvents: ['onLanguage:cobol'],
    contributes: {
        commands: [
            {
                command: 'cobol-indent',
                title: 'Indent cobol',
                enablement: 'editorLangId == cobol && !inSnippetMode'
            },
            {
                command: 'cobol-unindent',
                title: 'Unindent cobol',
                enablement: 'editorLangId == cobol && !inSnippetMode'
            }
        ],
        keybindings: [
            {
                command: 'cobol-indent',
                key: 'tab',
                when: 'editorLangId == cobol && !inSnippetMode'
            },
            {
                command: 'cobol-unindent',
                key: 'shift+tab',
                when: 'editorLangId == cobol && !inSnippetMode'
            }
        ]
    },
    browser: './extension.js'
}, ExtensionHostKind.LocalWebWorker);
registerFileUrl('./extension.js', new URL(new URL('../assets/cobol-extension.js', import.meta.url).href).href);

export { whenReady };
