"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.activate = activate;
const tslib_1 = require("tslib");
const path_1 = tslib_1.__importDefault(require("path"));
const fs_1 = tslib_1.__importDefault(require("fs"));
const coc_nvim_1 = require("coc.nvim");
async function activate(context) {
    const config = coc_nvim_1.workspace.getConfiguration().get('sh', {});
    if (config.enable === false) {
        return;
    }
    const serverOptions = {
        command: (config.commandPath || require.resolve('bash-language-server/out/cli.js')),
        args: ['start'],
        transport: coc_nvim_1.TransportKind.stdio
    };
    const clientOptions = {
        documentSelector: ['sh']
    };
    const client = new coc_nvim_1.LanguageClient('sh', 'bash-language-server', serverOptions, clientOptions);
    context.subscriptions.push(coc_nvim_1.services.registLanguageClient(client), coc_nvim_1.commands.registerCommand("sh.version", async () => {
        const rootDir = path_1.default.join(__dirname, '..');
        const { version } = JSON.parse(fs_1.default.readFileSync(path_1.default.resolve(rootDir, 'package.json'), 'utf-8'));
        coc_nvim_1.window.showInformationMessage(`Version: ${version} [node: ${process.versions.node}]`);
    }));
}
//# sourceMappingURL=extension.js.map