/*
 * Copyright 2026, Jaime Terrats.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { Hono } from 'hono';
/**
 * LSP WebSocket Bridge Route
 *
 * Architecture (for future implementation):
 * 1. Client connects via WebSocket to /api/v1/lsp
 * 2. Server spawns `bin/lsp-server.js --stdio` as a child process
 * 3. WebSocket messages (JSON-RPC) are piped to child stdin
 * 4. Child stdout (JSON-RPC responses) are piped back to WebSocket
 * 5. On WebSocket close → kill child process
 * 6. On child exit → close WebSocket
 *
 * Implementation requires either:
 * - `@hono/node-ws` adapter for WebSocket upgrades within Hono, OR
 * - A separate `ws` WebSocketServer attached to the same HTTP server
 *
 * Neither `@hono/node-ws` nor `ws` are currently in project dependencies.
 * Adding them and wiring the upgrade path is deferred to a follow-up task.
 *
 * For now, Monaco runs with built-in language intelligence (syntax highlighting,
 * bracket matching, basic TypeScript/JavaScript completions via Monaco's bundled
 * language services). The LSP bridge will add project-aware completions,
 * go-to-definition, hover info, and diagnostics for Salesforce metadata.
 */
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function lspRoute(cwd) {
    const app = new Hono();
    app.get('/', (c) => c.json({
        status: 'not_implemented',
        message: 'LSP WebSocket bridge is planned but not yet active. ' +
            'Monaco editor uses built-in language services for now.',
        upgradePath: 'ws://HOST/api/v1/lsp/ws',
        requirements: ['@hono/node-ws or ws package', 'WebSocket upgrade handler'],
    }));
    app.all('/ws', (c) => c.json({
        error: 'Not Implemented',
        message: 'LSP WebSocket bridge requires @hono/node-ws or a separate ws server. ' +
            'Install the adapter and implement the child_process bridge to enable ' +
            'project-aware intellisense.',
    }, 501));
    return app;
}
//# sourceMappingURL=lsp.js.map