"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var tslib_1 = require("tslib"); var coc_nvim_1 = require("coc.nvim"); function activate(context) { return tslib_1.__awaiter(this, void 0, void 0, function () { var config, isEnable, serverModule, serverOptions, isEnableDebug, nvim, vimruntime, runtimepath, iskeyword, isEnableDiagnostic, fromVimruntime, fromRuntimepath, indexesRuntimepath, indexesCount, indexesGap, clientOptions, client; return tslib_1.__generator(this, function (_a) { switch (_a.label) { case 0: config = coc_nvim_1.workspace.getConfiguration('vimlsp'); isEnable = config.get('enable', true); // extension is disable if (!isEnable) { return [2 /*return*/]; } serverModule = require.resolve('vim-language-server'); serverOptions = { run: { module: serverModule, transport: coc_nvim_1.TransportKind.ipc }, debug: { module: serverModule, transport: coc_nvim_1.TransportKind.ipc } }; isEnableDebug = config.get('debug', false); // The debug options for the server if (isEnableDebug) { serverOptions.debug.options = { execArgv: [ "--nolazy", "--debug=6009" ] }; } nvim = coc_nvim_1.workspace.nvim; return [4 /*yield*/, nvim.commandOutput('echo $VIMRUNTIME')]; case 1: vimruntime = _a.sent(); return [4 /*yield*/, nvim.getOption('runtimepath')]; case 2: runtimepath = _a.sent(); return [4 /*yield*/, nvim.getOption('iskeyword')]; case 3: iskeyword = _a.sent(); isEnableDiagnostic = config.get('diagnostic.enable', true); fromVimruntime = config.get('suggest.fromVimruntime', true); fromRuntimepath = config.get('suggest.fromRuntimepath', false); indexesRuntimepath = config.get('indexes.runtimepath', true); indexesCount = config.get('indexes.count', 1); indexesGap = config.get('indexes.gap', 100); clientOptions = { documentSelector: ['vim'], initializationOptions: { iskeyword: iskeyword, vimruntime: vimruntime, runtimepath: runtimepath, diagnostic: { enable: isEnableDiagnostic }, indexes: { runtimepath: indexesRuntimepath, count: indexesCount, gap: indexesGap }, suggest: { fromVimruntime: fromVimruntime, fromRuntimepath: fromRuntimepath } } }; client = new coc_nvim_1.LanguageClient('vimlsp', 'vim language server', serverOptions, clientOptions); // Push the disposable to the context's subscriptions so that the // client can be deactivated on extension deactivation context.subscriptions.push(coc_nvim_1.services.registLanguageClient(client)); return [2 /*return*/]; } }); }); } exports.activate = activate; //# sourceMappingURL=index.js.map