"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.lsp = lsp;
const process = __importStar(require("process"));
const cdk_explorer_1 = require("@aws-cdk/cdk-explorer");
/**
 * Starts the CDK Language Server over stdio.
 *
 * The server speaks LSP/JSON-RPC on stdin/stdout, so this command must not
 * write anything else to stdout. CDK CLI logs go to stderr by default, which
 * keeps the protocol channel clean. The process runs until the LSP client
 * closes the stdio channel (stdin end), then exits 0.
 */
async function lsp() {
    (0, cdk_explorer_1.startLspServer)();
    await new Promise((resolve) => {
        const done = () => resolve();
        process.stdin.once('end', done);
        process.stdin.once('close', done);
    });
    return 0;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibHNwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsibHNwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGlu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