@askdkc/dsh-lsp-server 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/LICENSE +21 -0
- package/README.md +27 -0
- package/cordis.patch.yml +29 -0
- package/docs/usage.md +94 -0
- package/lib/cli/doctor.js +135 -0
- package/lib/cli/doctor.js.map +1 -0
- package/lib/completion-B7NPVCEN.js +79 -0
- package/lib/completion-B7NPVCEN.js.map +1 -0
- package/lib/errors-DtyWAUi0.js +16 -0
- package/lib/errors-DtyWAUi0.js.map +1 -0
- package/lib/extra-tool.js +113 -0
- package/lib/extra-tool.js.map +1 -0
- package/lib/launch-ByUvgkVv.js +308 -0
- package/lib/launch-ByUvgkVv.js.map +1 -0
- package/lib/provider.js +1164 -0
- package/lib/provider.js.map +1 -0
- package/lib/types/cli/availability.d.ts +3 -0
- package/lib/types/cli/doctor.d.ts +33 -0
- package/lib/types/config.d.ts +87 -0
- package/lib/types/errors.d.ts +7 -0
- package/lib/types/extra-tool.d.ts +13 -0
- package/lib/types/host/dsh.d.ts +10 -0
- package/lib/types/host/source.d.ts +8 -0
- package/lib/types/host/uri.d.ts +2 -0
- package/lib/types/host/workspace.d.ts +16 -0
- package/lib/types/merge/completion.d.ts +6 -0
- package/lib/types/merge/diagnostics.d.ts +6 -0
- package/lib/types/merge/hover.d.ts +5 -0
- package/lib/types/protocol/capabilities.d.ts +3 -0
- package/lib/types/protocol/initialize.d.ts +3 -0
- package/lib/types/protocol/normalize-completion.d.ts +3 -0
- package/lib/types/protocol/normalize-diagnostic.d.ts +3 -0
- package/lib/types/protocol/normalize-hover.d.ts +6 -0
- package/lib/types/protocol/normalize-location.d.ts +7 -0
- package/lib/types/protocol/types.d.ts +57 -0
- package/lib/types/provider.d.ts +35 -0
- package/lib/types/routing/classifier.d.ts +8 -0
- package/lib/types/routing/language-id.d.ts +5 -0
- package/lib/types/routing/route-table.d.ts +13 -0
- package/lib/types/routing/tailwind-candidate.d.ts +1 -0
- package/lib/types/runtime/cancellation.d.ts +4 -0
- package/lib/types/runtime/connection.d.ts +22 -0
- package/lib/types/runtime/framing.d.ts +14 -0
- package/lib/types/runtime/process-lifecycle.d.ts +21 -0
- package/lib/types/runtime/server-pool.d.ts +24 -0
- package/lib/types/runtime/server-session.d.ts +32 -0
- package/lib/types/runtime/webstack-runtime.d.ts +28 -0
- package/lib/types/servers/html.d.ts +2 -0
- package/lib/types/servers/launch.d.ts +5 -0
- package/lib/types/servers/package-bin.d.ts +2 -0
- package/lib/types/servers/phpantom.d.ts +2 -0
- package/lib/types/servers/svelte.d.ts +2 -0
- package/lib/types/servers/tailwind.d.ts +2 -0
- package/lib/types/servers/types.d.ts +26 -0
- package/lib/types/servers/typescript.d.ts +2 -0
- package/lib/types/service.d.ts +83 -0
- package/package.json +138 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.js","names":["CLASSIFIERS: ReadonlyArray<{ suffix: string; kind: FileKind }>","ROUTES: Record<ClassifiedFile['kind'], Route>","maxMessageBytes: number","messages: unknown[]","text: string","length: number | undefined","input: Readable","output: Writable","messages: unknown[]","isRecord","options: ServerSessionOptions","factory: SessionFactory<S>","release!: () => void","isRange","isRecord","isPosition","isRecord","isRange","isPosition","isRecord","config: ResolvedConfig","fs: HostFileSystem","subprocess: HostSubprocess","executable: string","auxiliary: typeof primary","omittedServers: string[]"],"sources":["../src/runtime/cancellation.ts","../src/host/dsh.ts","../src/routing/classifier.ts","../src/routing/route-table.ts","../src/routing/tailwind-candidate.ts","../src/protocol/initialize.ts","../src/runtime/framing.ts","../src/runtime/connection.ts","../src/runtime/server-session.ts","../src/runtime/server-pool.ts","../src/protocol/capabilities.ts","../src/protocol/normalize-hover.ts","../src/protocol/normalize-location.ts","../src/protocol/normalize-diagnostic.ts","../src/protocol/normalize-completion.ts","../src/merge/hover.ts","../src/runtime/webstack-runtime.ts","../src/provider.ts"],"sourcesContent":["export function abortError(): Error {\n const error = new Error('The operation was aborted')\n error.name = 'AbortError'\n return error\n}\n\nexport function throwIfAborted(signal?: AbortSignal): void {\n if (signal?.aborted) throw abortError()\n}\n\nexport function onAbort(signal: AbortSignal | undefined, callback: () => void): () => void {\n if (!signal) return () => {}\n if (signal.aborted) {\n callback()\n return () => {}\n }\n signal.addEventListener('abort', callback, { once: true })\n return () => signal.removeEventListener('abort', callback)\n}\n\nexport async function withAbort<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T> {\n throwIfAborted(signal)\n if (!signal) return promise\n return new Promise<T>((resolve, reject) => {\n const remove = onAbort(signal, () => reject(abortError()))\n promise.then((value) => { remove(); resolve(value) }, (error: unknown) => { remove(); reject(error) })\n })\n}\n","import type { FileSystem } from '@deepseek-ai/dsh-fs'\nimport { WebstackLspError } from '../errors.js'\nimport { throwIfAborted } from '../runtime/cancellation.js'\n\nexport type HostFileSystem = Pick<FileSystem, 'resolve' | 'stat' | 'processPath' | 'fileUrl' | 'contains' | 'streamText'>\nexport interface HostSource { workspace: string; workspaceUri: string; key: string; uri: string; text: string }\n\nexport async function readSource(fs: HostFileSystem, workspaceRoot: string, filePath: string, maxBytes: number, signal?: AbortSignal): Promise<HostSource> {\n if (!workspaceRoot?.trim() || !filePath?.trim()) throw new WebstackLspError('LSP_WORKSPACE_REQUIRED', 'workspaceRoot and filePath are required')\n throwIfAborted(signal)\n const options = signal ? { signal } : {}\n const root = await fs.resolve(workspaceRoot, options)\n if ((await fs.stat(root, signal))?.type !== 'directory') throw new Error('workspace root is not a directory')\n const workspace = fs.processPath(root)\n const target = await fs.resolve(filePath, { cwd: workspace, ...options })\n if (!fs.contains(root, target)) throw new Error('source is outside workspace')\n if ((await fs.stat(target, signal))?.type !== 'file') throw new Error('source is not a regular file')\n let text = '', bytes = 0\n for await (const chunk of await fs.streamText(target, signal)) {\n throwIfAborted(signal)\n bytes += Buffer.byteLength(chunk)\n if (bytes > maxBytes) throw new Error('source exceeds document limit')\n text += chunk\n }\n throwIfAborted(signal)\n return { workspace, workspaceUri: fs.fileUrl(root), key: root.targetKey, uri: fs.fileUrl(target), text }\n}\n","export type FileKind = 'blade' | 'php' | 'typescript' | 'typescriptreact' | 'javascript' | 'javascriptreact' | 'svelte' | 'html' | 'css'\n\nexport interface ClassifiedFile {\n path: string\n basename: string\n suffix: string\n kind: FileKind\n}\n\nconst CLASSIFIERS: ReadonlyArray<{ suffix: string; kind: FileKind }> = [\n { suffix: '.blade.php', kind: 'blade' },\n { suffix: '.typescriptreact', kind: 'typescriptreact' },\n { suffix: '.javascriptreact', kind: 'javascriptreact' },\n { suffix: '.tsx', kind: 'typescriptreact' },\n { suffix: '.jsx', kind: 'javascriptreact' },\n { suffix: '.mts', kind: 'typescript' },\n { suffix: '.cts', kind: 'typescript' },\n { suffix: '.mjs', kind: 'javascript' },\n { suffix: '.cjs', kind: 'javascript' },\n { suffix: '.svelte', kind: 'svelte' },\n { suffix: '.html', kind: 'html' },\n { suffix: '.htm', kind: 'html' },\n { suffix: '.php', kind: 'php' },\n { suffix: '.ts', kind: 'typescript' },\n { suffix: '.js', kind: 'javascript' },\n { suffix: '.css', kind: 'css' },\n { suffix: '.pcss', kind: 'css' },\n]\n\nexport function classifyFile(filePath: string, bladeSuffixes: string[] = ['.blade.php']): ClassifiedFile | undefined {\n const normalizedPath = filePath.replaceAll('\\\\', '/')\n const basename = normalizedPath.slice(normalizedPath.lastIndexOf('/') + 1).toLowerCase()\n if (!basename || basename === '.' || basename === '..' || basename.startsWith('.')) return undefined\n const customBlade = bladeSuffixes.map((suffix) => suffix.toLowerCase()).sort((left, right) => right.length - left.length)\n const classifiers = [...customBlade.map((suffix) => ({ suffix, kind: 'blade' as const })), ...CLASSIFIERS.filter((item) => !customBlade.includes(item.suffix))]\n const match = classifiers.find((item) => basename.endsWith(item.suffix))\n if (!match) return undefined\n return { path: normalizedPath, basename, suffix: match.suffix, kind: match.kind }\n}\n","import type { ServerId } from '../config.js'\nimport type { ClassifiedFile } from './classifier.js'\n\nexport interface Route {\n primary: { server: ServerId; languageId: string }\n auxiliary?: { server: 'tailwind'; languageId: string }\n}\n\nconst ROUTES: Record<ClassifiedFile['kind'], Route> = {\n blade: { primary: { server: 'phpantom', languageId: 'blade' }, auxiliary: { server: 'tailwind', languageId: 'html' } },\n php: { primary: { server: 'phpantom', languageId: 'php' } },\n typescript: { primary: { server: 'typescript', languageId: 'typescript' }, auxiliary: { server: 'tailwind', languageId: 'typescript' } },\n typescriptreact: { primary: { server: 'typescript', languageId: 'typescriptreact' }, auxiliary: { server: 'tailwind', languageId: 'typescriptreact' } },\n javascript: { primary: { server: 'typescript', languageId: 'javascript' }, auxiliary: { server: 'tailwind', languageId: 'javascript' } },\n javascriptreact: { primary: { server: 'typescript', languageId: 'javascriptreact' }, auxiliary: { server: 'tailwind', languageId: 'javascriptreact' } },\n svelte: { primary: { server: 'svelte', languageId: 'svelte' }, auxiliary: { server: 'tailwind', languageId: 'svelte' } },\n html: { primary: { server: 'html', languageId: 'html' }, auxiliary: { server: 'tailwind', languageId: 'html' } },\n css: { primary: { server: 'css', languageId: 'css' }, auxiliary: { server: 'tailwind', languageId: 'css' } },\n}\n\nexport function routeFor(file: ClassifiedFile): Route {\n const route = ROUTES[file.kind]\n return { primary: { ...route.primary }, ...(route.auxiliary ? { auxiliary: { ...route.auxiliary } } : {}) }\n}\n","const DEFAULT_PATTERNS = [\n /\\bclass\\s*=\\s*[\"'][^\"']*$/i,\n /\\bclassName\\s*=\\s*[\"'][^\"']*$/i,\n /\\bclass:list\\s*=\\s*[\"'][^\"']*$/i,\n /@apply\\s+[\\w-]*$/i,\n /\\b(?:clsx|cva)\\s*\\([^)]*[\"'][^\"']*$/i,\n]\n\nexport function hasTailwindCandidate(source: string, line: number, classRegex: Array<string | [string, string]> = [], character?: number, classAttributes: string[] = ['class', 'className', 'class:list']): boolean {\n const lines = source.split(/\\r?\\n/)\n const context = [...lines.slice(Math.max(0, line - 2), line), (lines[line] ?? '').slice(0, character)].join('\\n')\n if (classAttributes.some(attribute => {\n const index = context.lastIndexOf(attribute + '=')\n return index >= 0 && /^[\\\"'][^\\\"']*$/.test(context.slice(index + attribute.length + 1).trimStart())\n })) return true\n const configured = classRegex.flatMap((item) => Array.isArray(item) ? item : [item]).map((pattern) => new RegExp(pattern))\n return [...DEFAULT_PATTERNS, ...configured].some((pattern) => pattern.test(context))\n}\n","import type { InitializeParams, InitializeResult } from './types.js'\nimport type { JsonRpcConnection } from '../runtime/connection.js'\nimport { throwIfAborted } from '../runtime/cancellation.js'\n\nexport async function initializeServer(connection: JsonRpcConnection, params: InitializeParams, signal?: AbortSignal): Promise<InitializeResult> {\n throwIfAborted(signal)\n const value = await connection.request('initialize', params, signal)\n if (!isInitializeResult(value)) throw new Error('malformed initialize response')\n await connection.notify('initialized', {})\n return value\n}\n\nfunction isInitializeResult(value: unknown): value is InitializeResult {\n return typeof value === 'object' && value !== null && !Array.isArray(value) && typeof (value as { capabilities?: unknown }).capabilities === 'object' && (value as { capabilities?: unknown }).capabilities !== null\n}\n","import { TextDecoder } from 'node:util'\n\nexport class JsonRpcFrameError extends Error {\n readonly code = 'LSP_MALFORMED_RESPONSE'\n\n constructor(message: string) {\n super(message)\n this.name = 'JsonRpcFrameError'\n }\n}\n\nexport class ContentLengthDecoder {\n private buffer = Buffer.alloc(0)\n private readonly decoder = new TextDecoder('utf-8', { fatal: true })\n\n constructor(private readonly maxMessageBytes: number) {\n if (!Number.isSafeInteger(maxMessageBytes) || maxMessageBytes <= 0) throw new RangeError('maxMessageBytes must be positive')\n }\n\n feed(chunk: Uint8Array): unknown[] {\n this.buffer = Buffer.concat([this.buffer, Buffer.from(chunk)])\n const messages: unknown[] = []\n while (true) {\n const headerEnd = this.buffer.indexOf(Buffer.from('\\r\\n\\r\\n'))\n if (headerEnd < 0) {\n if (this.buffer.length > 8192) throw new JsonRpcFrameError('header exceeds limit')\n break\n }\n const header = this.buffer.subarray(0, headerEnd).toString('ascii')\n const length = this.parseLength(header)\n const bodyStart = headerEnd + 4\n if (length > this.maxMessageBytes) throw new JsonRpcFrameError('message exceeds configured limit')\n if (this.buffer.length < bodyStart + length) break\n const body = this.buffer.subarray(bodyStart, bodyStart + length)\n this.buffer = this.buffer.subarray(bodyStart + length)\n let text: string\n try {\n text = this.decoder.decode(body)\n } catch {\n throw new JsonRpcFrameError('message is not valid UTF-8')\n }\n try {\n messages.push(JSON.parse(text) as unknown)\n } catch {\n throw new JsonRpcFrameError('message body is not valid JSON')\n }\n }\n return messages\n }\n\n end(): void {\n if (this.buffer.length > 0) throw new JsonRpcFrameError('incomplete JSON-RPC frame')\n }\n\n private parseLength(header: string): number {\n const lines = header.split('\\r\\n')\n let length: number | undefined\n for (const line of lines) {\n const separator = line.indexOf(':')\n if (separator < 1) throw new JsonRpcFrameError('malformed header')\n const key = line.slice(0, separator).toLowerCase()\n const value = line.slice(separator + 1).trim()\n if (key === 'content-length') {\n if (length !== undefined || !/^\\d+$/.test(value)) throw new JsonRpcFrameError('invalid Content-Length')\n length = Number(value)\n }\n }\n if (length === undefined || !Number.isSafeInteger(length)) throw new JsonRpcFrameError('Content-Length is required')\n return length\n }\n}\n\nexport function encodeJsonRpc(message: object): Buffer {\n const body = Buffer.from(JSON.stringify(message), 'utf8')\n return Buffer.concat([Buffer.from(`Content-Length: ${body.length}\\r\\n\\r\\n`, 'ascii'), body])\n}\n","import type { Readable, Writable } from 'node:stream'\nimport { abortError, onAbort, throwIfAborted } from './cancellation.js'\nimport { ContentLengthDecoder, encodeJsonRpc, JsonRpcFrameError } from './framing.js'\nimport type { JsonRpcConnectionOptions, JsonRpcId, JsonRpcMessage, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse } from '../protocol/types.js'\n\ninterface PendingRequest {\n resolve: (value: unknown) => void\n reject: (error: unknown) => void\n method: string\n}\n\nexport class JsonRpcConnection {\n private readonly decoder: ContentLengthDecoder\n private readonly pending = new Map<JsonRpcId, PendingRequest>()\n private readonly notificationListeners = new Set<(notification: JsonRpcNotification) => void>()\n private nextId = 1\n private closed = false\n private requestHandler: NonNullable<JsonRpcConnectionOptions['onServerRequest']>\n\n constructor(private readonly input: Readable, private readonly output: Writable, options: JsonRpcConnectionOptions) {\n this.decoder = new ContentLengthDecoder(options.maxMessageBytes)\n this.requestHandler = options.onServerRequest ?? (() => null)\n if (options.onNotification) this.notificationListeners.add(options.onNotification)\n input.on('data', (chunk: Buffer) => this.receive(chunk))\n input.once('end', () => this.close(new Error('LSP process closed stdout')))\n input.once('error', (error) => this.close(error))\n output.on('error', (error) => this.close(error))\n }\n\n get isOpen(): boolean { return !this.closed }\n\n onNotification(listener: (notification: JsonRpcNotification) => void): () => void {\n this.notificationListeners.add(listener)\n return () => this.notificationListeners.delete(listener)\n }\n\n setRequestHandler(handler: NonNullable<JsonRpcConnectionOptions['onServerRequest']>): void {\n this.requestHandler = handler\n }\n\n async request(method: string, params?: unknown, signal?: AbortSignal): Promise<unknown> {\n throwIfAborted(signal)\n if (this.closed) throw new Error('connection is closed')\n const id = this.nextId++\n const promise = new Promise<unknown>((resolve, reject) => this.pending.set(id, { resolve, reject, method }))\n void promise.catch(() => {})\n const remove = onAbort(signal, () => {\n void this.notify('$/cancelRequest', { id }).catch(() => {})\n this.pending.get(id)?.reject(abortError())\n this.pending.delete(id)\n })\n try {\n void this.write({ jsonrpc: '2.0', id, method, ...(params === undefined ? {} : { params }) }).catch(error => this.close(error))\n return await promise\n } finally {\n remove()\n this.pending.delete(id)\n }\n }\n\n async notify(method: string, params?: unknown): Promise<void> {\n if (this.closed) throw new Error('connection is closed')\n await this.write({ jsonrpc: '2.0', method, ...(params === undefined ? {} : { params }) })\n }\n\n close(reason = new Error('connection closed')): void {\n if (this.closed) return\n this.closed = true\n for (const pending of this.pending.values()) pending.reject(reason)\n this.pending.clear()\n }\n\n private receive(chunk: Buffer): void {\n if (this.closed) return\n let messages: unknown[]\n try {\n messages = this.decoder.feed(chunk)\n } catch (error) {\n this.close(error instanceof Error ? error : new JsonRpcFrameError('invalid frame'))\n return\n }\n for (const message of messages) this.dispatch(message)\n }\n\n private dispatch(value: unknown): void {\n if (!isRecord(value) || value.jsonrpc !== '2.0') return this.close(new JsonRpcFrameError('invalid JSON-RPC message'))\n if ('method' in value && typeof value.method === 'string') {\n if ('id' in value) {\n const request = value as unknown as JsonRpcRequest\n Promise.resolve().then(() => this.requestHandler(request.method, request.params)).then(\n (result) => this.write({ jsonrpc: '2.0', id: request.id, result }),\n (error: unknown) => this.write({ jsonrpc: '2.0', id: request.id, error: { code: -32603, message: error instanceof Error ? error.message : 'server request failed' } }),\n ).catch(() => {})\n } else {\n for (const listener of this.notificationListeners) listener(value as unknown as JsonRpcNotification)\n }\n return\n }\n if ('id' in value) {\n const response = value as unknown as JsonRpcResponse\n const pending = this.pending.get(response.id)\n if (!pending) return\n if (response.error) pending.reject(new Error(`${response.error.code}: ${response.error.message}`))\n else pending.resolve(response.result)\n this.pending.delete(response.id)\n }\n }\n\n private write(message: JsonRpcMessage): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n this.output.write(encodeJsonRpc(message), (error?: Error | null) => error ? reject(error) : resolve())\n })\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n","import type { SubprocessHandle } from '@deepseek-ai/dsh-subprocess'\nimport type { InitializeParams, InitializeResult } from '../protocol/types.js'\nimport { initializeServer } from '../protocol/initialize.js'\nimport { JsonRpcConnection } from './connection.js'\nimport { withAbort, throwIfAborted } from './cancellation.js'\n\nexport type SessionState = 'NEW' | 'STARTING' | 'READY' | 'STOPPING' | 'STOPPED' | 'FAILED'\nexport interface ServerSessionOptions {\n spawn(): SubprocessHandle\n initialize: InitializeParams\n configuration: unknown\n maxMessageBytes: number\n shutdown: { shutdownMs: number; killGraceMs: number }\n}\n\nexport class ServerSession {\n state: SessionState = 'NEW'\n capabilities: Record<string, unknown> = {}\n private child?: SubprocessHandle\n private connection?: JsonRpcConnection\n private stopping?: Promise<void>\n private readonly lifetime = new AbortController()\n constructor(private readonly options: ServerSessionOptions) {}\n\n async start(signal?: AbortSignal): Promise<InitializeResult> {\n throwIfAborted(signal)\n this.state = 'STARTING'\n try {\n const child = this.options.spawn()\n this.child = child\n // Observe failed spawn even when stdio could not be allocated.\n void child.done.catch(() => {})\n if (!child.stdout || !child.stdin) throw new Error('server stdio is unavailable')\n const connection = new JsonRpcConnection(child.stdout, child.stdin, {\n maxMessageBytes: this.options.maxMessageBytes,\n onServerRequest: (method, params) => this.answer(method, params),\n })\n this.connection = connection\n void child.done.then(() => connection.close(new Error('LSP process exited')), error => connection.close(error instanceof Error ? error : new Error('LSP spawn failed'))).then(() => {\n if (this.state !== 'STOPPING' && this.state !== 'STOPPED') this.state = 'FAILED'\n })\n const result = await initializeServer(connection, this.options.initialize, this.signal(signal))\n if (result.capabilities.positionEncoding && result.capabilities.positionEncoding !== 'utf-16') throw new Error('server requires unsupported position encoding')\n const sync = result.capabilities.textDocumentSync\n if (sync === undefined || sync === 0 || (typeof sync === 'object' && sync !== null && !(sync as { openClose?: boolean }).openClose)) throw new Error('server does not support document open/close')\n this.capabilities = result.capabilities\n await connection.notify('workspace/didChangeConfiguration', { settings: this.options.configuration })\n throwIfAborted(this.signal(signal))\n this.state = 'READY'\n return result\n } catch (error) {\n this.state = 'FAILED'\n await this.stop()\n throw error\n }\n }\n\n get usable(): boolean { return this.state === 'READY' && !!this.connection?.isOpen }\n isUsable(): boolean { return this.usable }\n async run<T>(task: (connection: JsonRpcConnection) => Promise<T>, signal?: AbortSignal): Promise<T> {\n if (!this.usable || !this.connection) throw new Error('session is not ready')\n try { return await withAbort(task(this.connection), this.signal(signal)) }\n catch (error) {\n // Stop cancelled work before the next queued request can reuse this process.\n if (signal?.aborted || !this.connection.isOpen) await this.stop()\n throw error\n }\n }\n\n stop(): Promise<void> {\n return this.stopping ??= this.teardown()\n }\n private async teardown(): Promise<void> {\n this.state = 'STOPPING'\n this.lifetime.abort()\n const child = this.child, connection = this.connection\n const timeout = AbortSignal.timeout(this.options.shutdown.shutdownMs)\n if (connection?.isOpen) {\n try { await connection.request('shutdown', null, timeout); await connection.notify('exit') } catch {}\n }\n connection?.close(new Error('session stopped'))\n if (child) {\n child.terminate()\n if (!await child.waitForExit(AbortSignal.timeout(this.options.shutdown.killGraceMs + 1000))) throw new Error('language server process tree did not exit within the cleanup deadline')\n }\n this.state = 'STOPPED'\n }\n private signal(signal?: AbortSignal): AbortSignal { return signal ? AbortSignal.any([signal, this.lifetime.signal]) : this.lifetime.signal }\n private answer(method: string, params: unknown): unknown {\n if (method === 'workspace/applyEdit') return { applied: false, failureReason: 'read-only provider' }\n if (method === 'workspace/workspaceFolders') return this.options.initialize.workspaceFolders ?? []\n if (method === 'workspace/configuration') {\n const items = (params as { items?: Array<{ section?: string }> } | undefined)?.items ?? []\n return items.map(item => {\n let value = this.options.configuration\n for (const key of item.section?.split('.') ?? []) {\n value = typeof value === 'object' && value !== null ? (value as Record<string, unknown>)[key] : undefined\n }\n return value ?? null\n })\n }\n return null\n }\n}\n","import { throwIfAborted, withAbort } from './cancellation.js'\n\nexport interface PoolSession {\n readonly state: string\n start(signal?: AbortSignal): Promise<unknown>\n stop(): Promise<void>\n isUsable(): boolean\n}\nexport type SessionFactory<S extends PoolSession> = (serverId: string, workspace: string, signal?: AbortSignal) => Promise<S>\n\nexport class ServerPool<S extends PoolSession> {\n private readonly sessions = new Map<string, S>()\n private readonly creation = new Map<string, Promise<S>>()\n private readonly queues = new Map<string, Promise<void>>()\n private disposing = false\n constructor(private readonly factory: SessionFactory<S>) {}\n\n async getOrCreate(serverId: string, workspace: string, signal?: AbortSignal): Promise<S> {\n throwIfAborted(signal)\n if (this.disposing) throw new Error('server pool is disposing')\n const key = keyOf(serverId, workspace)\n const existing = this.sessions.get(key)\n if (existing?.isUsable()) return existing\n const pending = this.creation.get(key)\n if (pending) return withAbort(pending, signal)\n const creation = this.create(key, serverId, workspace, existing, signal)\n this.creation.set(key, creation)\n try { return await creation }\n finally { if (this.creation.get(key) === creation) this.creation.delete(key) }\n }\n\n run<T>(serverId: string, workspace: string, task: (session: S) => Promise<T>, signal?: AbortSignal): Promise<T> {\n return this.serialize(keyOf(serverId, workspace), async () => task(await this.getOrCreate(serverId, workspace, signal)), signal)\n }\n\n runWithRetry<T>(serverId: string, workspace: string, task: (session: S) => Promise<T>, signal?: AbortSignal): Promise<T> {\n // Keep failure eviction and the retry inside the same queue slot. A later query\n // must never enter a replacement process before the failed query finishes cleanup.\n return this.serialize(keyOf(serverId, workspace), async () => {\n for (let attempt = 0; ; attempt++) {\n const session = await this.getOrCreate(serverId, workspace, signal)\n try { return await task(session) }\n catch (error) {\n throwIfAborted(signal)\n if (attempt > 0 || session.isUsable()) throw error\n if (this.sessions.get(keyOf(serverId, workspace)) === session) await this.evict(serverId, workspace)\n }\n }\n }, signal)\n }\n\n async evict(serverId: string, workspace: string): Promise<void> {\n const key = keyOf(serverId, workspace)\n const session = this.sessions.get(key)\n this.sessions.delete(key)\n if (session) await session.stop()\n }\n\n async disposeAll(): Promise<void> {\n this.disposing = true\n const results = await Promise.allSettled([...this.sessions.values()].map(session => session.stop()))\n this.sessions.clear()\n await Promise.all([...this.creation.values()].map(creation => creation.then(session => session.stop(), () => {})))\n this.creation.clear()\n const failures = results.filter((result): result is PromiseRejectedResult => result.status === 'rejected')\n if (failures.length) throw new AggregateError(failures.map(result => result.reason), 'language server cleanup failed')\n }\n\n get size(): number { return this.sessions.size }\n\n private async serialize<T>(key: string, task: () => Promise<T>, signal?: AbortSignal): Promise<T> {\n const previous = this.queues.get(key) ?? Promise.resolve()\n let release!: () => void\n const current = new Promise<void>(resolve => { release = resolve })\n this.queues.set(key, current)\n try {\n await withAbort(previous, signal)\n throwIfAborted(signal)\n return await task()\n } finally {\n // A cancelled waiter cannot let its successor bypass still-running work.\n void previous.then(release, release)\n void current.then(() => { if (this.queues.get(key) === current) this.queues.delete(key) })\n }\n }\n\n private async create(key: string, serverId: string, workspace: string, previous?: S, signal?: AbortSignal): Promise<S> {\n if (previous) { this.sessions.delete(key); await previous.stop() }\n throwIfAborted(signal)\n const session = await this.factory(serverId, workspace, signal)\n try { await session.start(signal) } catch (error) { await session.stop(); throw error }\n if (this.disposing) { await session.stop(); throw new Error('server pool is disposing') }\n this.sessions.set(key, session)\n return session\n }\n}\n\nexport function keyOf(serverId: string, workspace: string): string { return `${serverId}\\u0000${workspace}` }\n","export type StandardOperation = 'goToDefinition' | 'findReferences' | 'goToImplementation' | 'hover'\n\nexport function supportsOperation(capabilities: Record<string, unknown>, operation: StandardOperation): boolean {\n if (operation === 'goToDefinition') return capabilities.definitionProvider === true || isProvider(capabilities.definitionProvider)\n if (operation === 'findReferences') return capabilities.referencesProvider === true || isProvider(capabilities.referencesProvider)\n if (operation === 'goToImplementation') return capabilities.implementationProvider === true || isProvider(capabilities.implementationProvider)\n return capabilities.hoverProvider === true || isProvider(capabilities.hoverProvider)\n}\n\nfunction isProvider(value: unknown): boolean {\n return typeof value === 'object' && value !== null || value === true\n}\n\nexport function defaultServerRequest(method: string, params: unknown): unknown {\n if (method === 'workspace/configuration') {\n return Array.isArray(params) ? params.map(() => null) : []\n }\n if (method === 'window/workDoneProgress/create' || method === 'client/registerCapability' || method === 'client/unregisterCapability') return null\n if (method === 'workspace/applyEdit') return { applied: false, failureReason: 'read-only provider' }\n return null\n}\n","import type { LspRange } from '../service.js'\n\nexport interface NormalizedHover {\n contents: string\n range?: LspRange\n}\n\nexport function normalizeHover(value: unknown): NormalizedHover | null | undefined {\n if (value === null || value === undefined) return null\n if (typeof value !== 'object' || value === null) return undefined\n const record = value as { contents?: unknown; range?: unknown }\n const contents = normalizeContents(record.contents)\n if (contents === undefined) return undefined\n return { contents, ...(isRange(record.range) ? { range: record.range } : {}) }\n}\n\nfunction normalizeContents(value: unknown): string | undefined {\n if (typeof value === 'string') return value\n if (Array.isArray(value)) {\n const parts = value.map((item) => typeof item === 'string' ? item : isRecord(item) && typeof item.value === 'string' ? item.value : undefined)\n return parts.every((item): item is string => item !== undefined) ? parts.join('\\n') : undefined\n }\n if (isRecord(value) && typeof value.value === 'string') return value.value\n return undefined\n}\n\nfunction isRange(value: unknown): value is LspRange {\n return isRecord(value) && isPosition(value.start) && isPosition(value.end)\n}\n\nfunction isPosition(value: unknown): boolean {\n return isRecord(value) && Number.isInteger(value.line) && Number.isInteger(value.character) && value.line >= 0 && value.character >= 0\n}\n\nfunction isRecord(value: unknown): value is Record<string, any> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n","import type { LspPosition, LspRange } from '../service.js'\n\nexport interface NormalizedLocation {\n uri: string\n range: LspRange\n}\n\nexport function normalizeLocation(value: unknown): NormalizedLocation | undefined {\n if (isRecord(value) && typeof value.targetUri === 'string' && isRange(value.targetSelectionRange)) return { uri: value.targetUri, range: value.targetSelectionRange }\n if (!isRecord(value) || typeof value.uri !== 'string' || !isRange(value.range)) return undefined\n return { uri: value.uri, range: value.range }\n}\n\nexport function normalizeLocations(value: unknown): NormalizedLocation[] {\n const values = Array.isArray(value) ? value : value === null || value === undefined ? [] : [value]\n return values.map(normalizeLocation).filter((location): location is NormalizedLocation => location !== undefined)\n}\n\nfunction isRange(value: unknown): value is LspRange {\n return isRecord(value) && isPosition(value.start) && isPosition(value.end)\n}\n\nfunction isPosition(value: unknown): value is LspPosition {\n return isRecord(value) && Number.isInteger(value.line) && Number.isInteger(value.character) && value.line >= 0 && value.character >= 0\n}\n\nfunction isRecord(value: unknown): value is Record<string, any> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n","import type { LspRange, NormalizedDiagnostic } from '../service.js'\n\nexport function normalizeDiagnostic(value: unknown, server: string, fallbackUri: string): NormalizedDiagnostic | undefined {\n if (!isRecord(value) || !isRange(value.range) || typeof value.message !== 'string') return undefined\n const uri = typeof value.uri === 'string' ? value.uri : fallbackUri\n const severity = typeof value.severity === 'number' && value.severity >= 1 && value.severity <= 4 ? value.severity as 1 | 2 | 3 | 4 : undefined\n const code = typeof value.code === 'string' || typeof value.code === 'number' ? value.code : undefined\n return { server, uri, range: value.range, message: value.message, ...(severity === undefined ? {} : { severity }), ...(code === undefined ? {} : { code }), ...(typeof value.source === 'string' ? { source: value.source } : {}) }\n}\n\nexport function normalizeDiagnostics(value: unknown, server: string, fallbackUri: string): NormalizedDiagnostic[] {\n const values = Array.isArray(value) ? value : []\n return values.map((item) => normalizeDiagnostic(item, server, fallbackUri)).filter((item): item is NormalizedDiagnostic => item !== undefined)\n}\n\nfunction isRange(value: unknown): value is LspRange {\n return isRecord(value) && isPosition(value.start) && isPosition(value.end)\n}\n\nfunction isPosition(value: unknown): boolean {\n return isRecord(value) && Number.isInteger(value.line) && Number.isInteger(value.character) && value.line >= 0 && value.character >= 0\n}\n\nfunction isRecord(value: unknown): value is Record<string, any> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n","import type { NormalizedCompletionItem } from '../service.js'\n\nexport function normalizeCompletionItem(value: unknown, server: string): NormalizedCompletionItem | undefined {\n if (!isRecord(value) || typeof value.label !== 'string' || value.label.length === 0) return undefined\n return {\n server,\n label: value.label,\n ...(typeof value.kind === 'number' ? { kind: value.kind } : {}),\n ...(typeof value.detail === 'string' ? { detail: value.detail } : {}),\n ...(typeof value.documentation === 'string' ? { documentation: value.documentation } : {}),\n ...(typeof value.sortText === 'string' ? { sortText: value.sortText } : {}),\n ...(typeof value.filterText === 'string' ? { filterText: value.filterText } : {}),\n ...(typeof value.insertText === 'string' ? { insertText: value.insertText } : {}),\n ...(typeof value.insertTextFormat === 'number' ? { insertTextFormat: value.insertTextFormat } : {}),\n ...(typeof value.deprecated === 'boolean' ? { deprecated: value.deprecated } : {}),\n }\n}\n\nexport function normalizeCompletion(value: unknown, server: string): NormalizedCompletionItem[] {\n const items = isRecord(value) && Array.isArray(value.items) ? value.items : Array.isArray(value) ? value : []\n return items.map((item) => normalizeCompletionItem(item, server)).filter((item): item is NormalizedCompletionItem => item !== undefined)\n}\n\nfunction isRecord(value: unknown): value is Record<string, any> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n","import type { NormalizedHover } from '../protocol/normalize-hover.js'\nimport type { LspRange } from '../service.js'\n\nexport interface ServerHover extends NormalizedHover {\n server: string\n}\n\nexport function mergeHover(primary: ServerHover | null | undefined, auxiliary: ServerHover | null | undefined): ServerHover | null {\n if (!primary && !auxiliary) return null\n if (!primary) return auxiliary ? { ...auxiliary } : null\n if (!auxiliary) return { ...primary }\n const contents = [primary.contents, auxiliary.contents].filter((value, index, values) => values.indexOf(value) === index)\n const range = sameRange(primary.range, auxiliary.range) ? primary.range : undefined\n return { server: primary.server, contents: contents.join('\\n\\n'), ...(range ? { range } : {}) }\n}\n\nfunction sameRange(left: LspRange | undefined, right: LspRange | undefined): boolean {\n return JSON.stringify(left) === JSON.stringify(right)\n}\n","import type { LspProviderQuery, LspQueryResult } from '@deepseek-ai/dsh-lsp'\nimport type { SubprocessService } from '@deepseek-ai/dsh-subprocess'\nimport type { ResolvedConfig, ServerId } from '../config.js'\nimport { SERVER_IDS } from '../config.js'\nimport { readSource, type HostFileSystem, type HostSource } from '../host/dsh.js'\nimport { classifyFile } from '../routing/classifier.js'\nimport { routeFor, type Route } from '../routing/route-table.js'\nimport { hasTailwindCandidate } from '../routing/tailwind-candidate.js'\nimport { resolveLaunch, initializationOptions, serverConfiguration } from '../servers/launch.js'\nimport { ServerSession } from './server-session.js'\nimport { ServerPool } from './server-pool.js'\nimport { throwIfAborted, withAbort } from './cancellation.js'\nimport { WebstackLspError } from '../errors.js'\nimport { supportsOperation } from '../protocol/capabilities.js'\nimport { normalizeHover } from '../protocol/normalize-hover.js'\nimport { normalizeLocations } from '../protocol/normalize-location.js'\nimport { normalizeDiagnostics } from '../protocol/normalize-diagnostic.js'\nimport { normalizeCompletion } from '../protocol/normalize-completion.js'\nimport { mergeHover } from '../merge/hover.js'\nimport { mergeDiagnostics } from '../merge/diagnostics.js'\nimport { mergeCompletions } from '../merge/completion.js'\nimport type { CompletionRequest, CompletionResult, DiagnosticsRequest, DiagnosticsResult, LspPosition, WebstackLspStatus } from '../service.js'\nimport type { JsonRpcConnection } from './connection.js'\n\nexport type HostSubprocess = Pick<SubprocessService, 'spawn' | 'resolveExecutable'>\nconst methods = { hover: 'textDocument/hover', goToDefinition: 'textDocument/definition', findReferences: 'textDocument/references', goToImplementation: 'textDocument/implementation' } as const\nconst clientCapabilities = {\n general: { positionEncodings: ['utf-16'] },\n workspace: { configuration: true, workspaceFolders: true, applyEdit: false },\n textDocument: {\n synchronization: { dynamicRegistration: false, didSave: false },\n hover: { contentFormat: ['markdown', 'plaintext'] },\n completion: { completionItem: { snippetSupport: true, documentationFormat: ['markdown', 'plaintext'] } },\n publishDiagnostics: { versionSupport: true }, diagnostic: {},\n },\n}\n\nexport class WebstackLspRuntime {\n private readonly pool: ServerPool<ServerSession>\n private readonly workspaces = new Map<string, HostSource>()\n private readonly lifetime = new AbortController()\n private readonly live = new Map<ServerSession, ServerId>()\n private readonly starts = new Map<string, number>()\n private readonly restarts = new Map<ServerId, number>()\n constructor(private readonly config: ResolvedConfig, private readonly fs: HostFileSystem, private readonly subprocess: HostSubprocess) {\n this.pool = new ServerPool(async (rawId, key, signal) => {\n const id = rawId as ServerId, source = this.workspaces.get(key)!\n const spec = await resolveLaunch(id, config, source.workspace)\n let executable: string\n try { executable = await subprocess.resolveExecutable(spec.command, spec.env, signal) }\n catch { throwIfAborted(signal); throw new WebstackLspError('LSP_UNAVAILABLE', `${id} executable is unavailable; run dsh-lsp-webstack --json`) }\n const session = new ServerSession({\n spawn: () => subprocess.spawn({ argv: [executable, ...spec.args], cwd: source.workspace, env: spec.env, stdio: { stdin: 'pipe', stdout: 'pipe', stderr: { maxBytes: config.limits.maxStderrBytes } }, graceMs: config.timeouts.killGraceMs }),\n initialize: { processId: null, rootUri: source.workspaceUri, workspaceFolders: [{ uri: source.workspaceUri, name: 'workspace' }], capabilities: clientCapabilities, initializationOptions: initializationOptions(id, config) },\n configuration: serverConfiguration(id, config), maxMessageBytes: config.limits.maxMessageBytes,\n shutdown: { shutdownMs: config.timeouts.shutdownMs, killGraceMs: config.timeouts.killGraceMs },\n })\n const slot = `${id}\\u0000${key}`\n if (this.starts.has(slot)) this.restarts.set(id, (this.restarts.get(id) ?? 0) + 1)\n this.starts.set(slot, (this.starts.get(slot) ?? 0) + 1)\n for (const [old] of this.live) if (old.state === 'STOPPED' || old.state === 'FAILED') this.live.delete(old)\n this.live.set(session, id)\n return session\n })\n }\n\n async navigation(request: LspProviderQuery, signal?: AbortSignal): Promise<LspQueryResult> {\n const deadline = this.signal(request.operation === 'hover' ? this.config.timeouts.primaryHoverMs : this.config.timeouts.navigationMs, signal)\n const [source, route] = await this.prepare(request, deadline)\n this.validatePosition(source.text, request.position)\n const result = await this.document(route.primary.server, source, route.primary.languageId, deadline, async (session, connection) => {\n if (!supportsOperation(session.capabilities, request.operation)) throw new WebstackLspError('LSP_UNSUPPORTED_OPERATION', `${route.primary.server} does not support ${request.operation}`)\n return connection.request(methods[request.operation], { textDocument: { uri: source.uri }, position: request.position, ...(request.operation === 'findReferences' ? { context: { includeDeclaration: true } } : {}) }, deadline)\n })\n if (request.operation !== 'hover') return { kind: 'locations', locations: normalizeLocations(result), resolvedWorkspaceUri: source.workspaceUri }\n const primary = normalizeHover(result)\n if (primary === undefined) throw new WebstackLspError('LSP_MALFORMED_RESPONSE', 'invalid hover result')\n let auxiliary = null\n if (this.useTailwind(route, source, request.position)) {\n const auxSignal = this.signal(this.config.timeouts.auxiliaryHoverMs, signal)\n try {\n const value = await this.document('tailwind', source, route.auxiliary!.languageId, auxSignal, (_session, connection) => connection.request('textDocument/hover', { textDocument: { uri: source.uri }, position: request.position }, auxSignal))\n auxiliary = normalizeHover(value) ?? null\n } catch { throwIfAborted(signal); throwIfAborted(this.lifetime.signal) }\n }\n const hover = mergeHover(primary && { ...primary, server: route.primary.server }, auxiliary && { ...auxiliary, server: 'tailwind' })\n return { kind: 'hover', hover: hover ? { contents: hover.contents, ...(hover.range ? { range: hover.range } : {}) } : null }\n }\n\n async completion(request: CompletionRequest, signal?: AbortSignal): Promise<CompletionResult> {\n const deadline = this.signal(this.config.timeouts.completionMs, signal)\n const [source, route] = await this.prepare(request, deadline)\n this.validatePosition(source.text, request.position)\n const query = (id: ServerId, language: string) => this.document(id, source, language, deadline, (session, connection) => {\n if (!session.capabilities.completionProvider) throw new WebstackLspError('LSP_UNSUPPORTED_OPERATION', `${id} does not support completion`)\n return connection.request('textDocument/completion', { textDocument: { uri: source.uri }, position: request.position, context: { triggerKind: request.triggerKind ?? 1, ...(request.triggerCharacter ? { triggerCharacter: request.triggerCharacter } : {}) } }, deadline)\n }).then(value => {\n const prefix = source.text.split(/\\r?\\n/)[request.position.line]!.slice(0, request.position.character).match(/[\\w$:@/!\\[\\]-]+$/)?.[0]?.toLowerCase() ?? ''\n // Servers such as Tailwind return the whole catalog; the client must rank the typed prefix before applying a result cap.\n return normalizeCompletion(value, id).sort((a, b) => Number((b.filterText ?? b.label).toLowerCase().startsWith(prefix)) - Number((a.filterText ?? a.label).toLowerCase().startsWith(prefix)))\n })\n const primary = await query(route.primary.server, route.primary.languageId)\n let auxiliary: typeof primary = []\n if (this.useTailwind(route, source, request.position)) {\n try { auxiliary = await query('tailwind', route.auxiliary!.languageId) } catch { throwIfAborted(signal); throwIfAborted(this.lifetime.signal) }\n }\n return mergeCompletions([primary, auxiliary], { maxCompletions: Number.MAX_SAFE_INTEGER, maxResultChars: Number.MAX_SAFE_INTEGER })\n }\n\n async diagnostics(request: DiagnosticsRequest, signal?: AbortSignal): Promise<DiagnosticsResult> {\n const deadline = this.signal(this.config.timeouts.diagnosticsMs, signal)\n const [source, route] = await this.prepare(request, deadline)\n const selected = [route.primary, ...(route.auxiliary && this.config.tailwind.enabled ? [route.auxiliary] : [])].filter(item => this.config.servers[item.server].enabled && (!request.servers || request.servers.includes(item.server)))\n if (!selected.length) throw new WebstackLspError('LSP_UNAVAILABLE', 'no selected diagnostic server supports this file')\n const omittedServers: string[] = []\n const groups = await Promise.all(selected.map(async item => {\n try {\n const value = await this.document(item.server, source, item.languageId, deadline, async (session, connection, opened) => {\n if (session.capabilities.diagnosticProvider) {\n await opened()\n const report = await connection.request('textDocument/diagnostic', { textDocument: { uri: source.uri } }, deadline) as { items?: unknown }\n return report?.items ?? []\n }\n // Subscribe before didOpen; do not confuse a missing publication with a clean file.\n let remove = () => {}\n const published = new Promise<unknown>(resolve => {\n remove = connection.onNotification(message => {\n const p = message.params as { uri?: string; diagnostics?: unknown; version?: number } | undefined\n if (message.method === 'textDocument/publishDiagnostics' && p?.uri === source.uri && (p.version === undefined || p.version === 1)) resolve(p.diagnostics)\n })\n })\n try { await opened(); return await withAbort(published, deadline) } finally { remove() }\n }, true)\n return normalizeDiagnostics(value, item.server, source.uri).filter(d => !request.severity || request.severity === 'all' || d.severity === (request.severity === 'error' ? 1 : 2))\n } catch (error) {\n throwIfAborted(signal); throwIfAborted(this.lifetime.signal)\n if (item.server === route.primary.server || this.config.missingServerPolicy === 'error') throw error\n omittedServers.push(item.server)\n return []\n }\n }))\n return { ...mergeDiagnostics(groups, { maxDiagnostics: Number.MAX_SAFE_INTEGER, maxResultChars: Number.MAX_SAFE_INTEGER }), ...(omittedServers.length ? { omittedServers: omittedServers.sort() } : {}) }\n }\n\n async status(): Promise<WebstackLspStatus> {\n return { providerId: this.config.providerId, servers: await Promise.all(SERVER_IDS.map(async id => {\n const config = this.config.servers[id]\n let available = false\n try {\n const launch = await resolveLaunch(id, this.config, '.')\n await this.subprocess.resolveExecutable(launch.command, launch.env, this.signal(5000))\n available = true\n } catch {}\n return { id, enabled: config.enabled && (id !== 'tailwind' || this.config.tailwind.enabled), available, source: config.mode, liveWorkspaces: [...this.live].filter(([s, server]) => server === id && s.isUsable()).length, restarts: this.restarts.get(id) ?? 0 }\n })) }\n }\n\n async dispose(): Promise<void> { this.lifetime.abort(); await this.pool.disposeAll(); this.workspaces.clear(); this.live.clear() }\n\n private signal(ms: number, signal?: AbortSignal): AbortSignal { return AbortSignal.any([this.lifetime.signal, AbortSignal.timeout(ms), ...(signal ? [signal] : [])]) }\n private async prepare(request: { workspaceRoot: string; filePath: string }, signal: AbortSignal): Promise<[HostSource, Route]> {\n throwIfAborted(signal)\n const file = classifyFile(request.filePath, this.config.routing.bladeSuffixes)\n if (!file) throw new WebstackLspError('LSP_UNAVAILABLE', 'unsupported file extension')\n const source = await readSource(this.fs, request.workspaceRoot, request.filePath, this.config.limits.maxDocumentBytes, signal).catch(error => { throwIfAborted(signal); throw error })\n this.workspaces.set(source.key, { ...source, text: '' })\n return [source, routeFor(file)]\n }\n private validatePosition(text: string, position: LspPosition): void {\n const line = text.split(/\\r?\\n/)[position.line]\n if (!Number.isSafeInteger(position.line) || !Number.isSafeInteger(position.character) || position.line < 0 || position.character < 0 || line === undefined || position.character > line.length) throw new RangeError('position is outside document (zero-based UTF-16 required)')\n }\n private useTailwind(route: Route, source: HostSource, position: LspPosition): boolean {\n return !!route.auxiliary && this.config.tailwind.enabled && this.config.servers.tailwind.enabled && (route.primary.languageId === 'blade' || this.config.routing.tailwindLanguages.includes(route.primary.languageId) || route.primary.languageId === 'css') && (this.config.tailwind.queryStrategy === 'always' || hasTailwindCandidate(source.text, position.line, this.config.tailwind.classRegex, position.character, this.config.tailwind.classAttributes))\n }\n private async document<T>(id: ServerId, source: HostSource, language: string, signal: AbortSignal, task: (session: ServerSession, connection: JsonRpcConnection, open: () => Promise<void>) => Promise<T>, manualOpen = false): Promise<T> {\n if (!this.config.servers[id].enabled) throw new WebstackLspError('LSP_UNAVAILABLE', `${id} is disabled`)\n return this.pool.runWithRetry(id, source.key, session => session.run(async connection => {\n let opened = false\n const open = async () => { opened = true; await connection.notify('textDocument/didOpen', { textDocument: { uri: source.uri, languageId: language, version: 1, text: source.text } }) }\n try { if (!manualOpen) await open(); return await task(session, connection, open) }\n finally { if (opened && connection.isOpen) await connection.notify('textDocument/didClose', { textDocument: { uri: source.uri } }).catch(() => {}) }\n }, signal), signal)\n }\n}\n","import type { Context } from '@deepseek-ai/cordis'\nimport { LspProviderId } from '@deepseek-ai/dsh-lsp'\nimport type { LspProvider, LspProviderQuery, LspQueryResult } from '@deepseek-ai/dsh-lsp'\nimport type { Config as PluginConfig, ResolvedConfig } from './config.js'\nimport { resolveConfig } from './config.js'\nimport type { WebstackLspService } from './service.js'\nimport { createWebstackLspService } from './service.js'\nimport { WebstackLspRuntime } from './runtime/webstack-runtime.js'\nimport type {} from '@deepseek-ai/dsh-fs'\nimport type {} from '@deepseek-ai/dsh-subprocess'\n\nexport type { LspProvider, LspProviderQuery, LspQueryResult }\nexport type Config = PluginConfig\nexport const name = 'lsp-webstack-provider'\nexport const inject = ['fs', 'lsp', 'subprocess']\n\ndeclare module '@deepseek-ai/cordis' {\n interface Context { webstackLsp: WebstackLspService }\n}\n\nexport const OUTER_EXTENSION_MAP = {\n '.php': 'php', '.ts': 'typescript', '.tsx': 'typescriptreact', '.mts': 'typescript', '.cts': 'typescript',\n '.js': 'javascript', '.jsx': 'javascriptreact', '.mjs': 'javascript', '.cjs': 'javascript',\n '.svelte': 'svelte', '.html': 'html', '.htm': 'html', '.css': 'css', '.pcss': 'css',\n} as const\n\nexport interface CompositeRuntime {\n navigation(request: LspProviderQuery, signal?: AbortSignal): Promise<LspQueryResult>\n dispose?(): Promise<void>\n}\n\nexport function createCompositeProvider(runtime: CompositeRuntime, config: Pick<ResolvedConfig, 'providerId'> = { providerId: 'webstack' }): LspProvider {\n return { id: LspProviderId(config.providerId), extensionToLanguage: { ...OUTER_EXTENSION_MAP }, query: (request, signal) => runtime.navigation(request, signal) }\n}\n\nexport async function apply(ctx: Context, config: unknown = {}): Promise<void> {\n const resolved = resolveConfig(config)\n const runtime = new WebstackLspRuntime(resolved, ctx.fs, ctx.subprocess)\n await ctx.effect(async function* () {\n yield () => runtime.dispose()\n if (resolved.missingServerPolicy === 'error') {\n const missing = (await runtime.status()).servers.filter(server => server.enabled && !server.available)\n if (missing.length) throw new Error(`unavailable language servers: ${missing.map(server => server.id).join(', ')}`)\n }\n yield ctx.lsp.registerProvider(createCompositeProvider(runtime, resolved))\n yield ctx.provide('webstackLsp', createWebstackLspService(runtime))\n }, 'webstack LSP provider')\n}\n"],"mappings":";;;;;;;AAAA,SAAgB,aAAoB;CAClC,MAAM,wBAAQ,IAAI,MAAM,4BAA4B;AACpD,OAAM,OAAO;AACb,QAAO;;AAGT,SAAgB,eAAe,QAA4B;AACzD,KAAI,QAAQ,QAAS,OAAM,YAAY;;AAGzC,SAAgB,QAAQ,QAAiC,UAAkC;AACzF,KAAI,CAAC,OAAQ,cAAa;AAC1B,KAAI,OAAO,SAAS;AAClB,YAAU;AACV,eAAa;;AAEf,QAAO,iBAAiB,SAAS,UAAU,EAAE,MAAM,MAAM,CAAC;AAC1D,cAAa,OAAO,oBAAoB,SAAS,SAAS;;AAG5D,eAAsB,UAAa,SAAqB,QAAkC;AACxF,gBAAe,OAAO;AACtB,KAAI,CAAC,OAAQ,QAAO;AACpB,QAAO,IAAI,SAAY,SAAS,WAAW;EACzC,MAAM,SAAS,QAAQ,cAAc,OAAO,YAAY,CAAC,CAAC;AAC1D,UAAQ,MAAM,UAAU;AAAE,WAAQ;AAAE,WAAQ,MAAM;MAAK,UAAmB;AAAE,WAAQ;AAAE,UAAO,MAAM;IAAG;GACtG;;;;;ACnBJ,eAAsB,WAAW,IAAoB,eAAuB,UAAkB,UAAkB,QAA2C;AACzJ,KAAI,CAAC,eAAe,MAAM,IAAI,CAAC,UAAU,MAAM,CAAE,OAAM,IAAI,iBAAiB,0BAA0B,0CAA0C;AAChJ,gBAAe,OAAO;CACtB,MAAM,UAAU,SAAS,EAAE,QAAQ,GAAG,EAAE;CACxC,MAAM,OAAO,MAAM,GAAG,QAAQ,eAAe,QAAQ;AACrD,MAAK,MAAM,GAAG,KAAK,MAAM,OAAO,GAAG,SAAS,YAAa,OAAM,IAAI,MAAM,oCAAoC;CAC7G,MAAM,YAAY,GAAG,YAAY,KAAK;CACtC,MAAM,SAAS,MAAM,GAAG,QAAQ,UAAU;EA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env node
|
|
2
|
+
import type { WebstackLspService } from '../service.js';
|
|
3
|
+
export interface DoctorOptions {
|
|
4
|
+
json?: boolean;
|
|
5
|
+
deep?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface DoctorIssue {
|
|
8
|
+
code: string;
|
|
9
|
+
severity: 'warning' | 'error';
|
|
10
|
+
message: string;
|
|
11
|
+
}
|
|
12
|
+
export interface DoctorReport {
|
|
13
|
+
providerId: string;
|
|
14
|
+
ok: boolean;
|
|
15
|
+
servers: Array<{
|
|
16
|
+
id: string;
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
available: boolean;
|
|
19
|
+
source: string;
|
|
20
|
+
command?: string;
|
|
21
|
+
version?: string;
|
|
22
|
+
liveWorkspaces: number;
|
|
23
|
+
restarts: number;
|
|
24
|
+
}>;
|
|
25
|
+
issues: DoctorIssue[];
|
|
26
|
+
deep?: {
|
|
27
|
+
checked: boolean;
|
|
28
|
+
readOnly: true;
|
|
29
|
+
notes: string[];
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export declare function collectDoctorReport(service: WebstackLspService, options?: DoctorOptions): Promise<DoctorReport>;
|
|
33
|
+
export declare function runDoctor(service: WebstackLspService, options?: DoctorOptions): Promise<string>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
export type ServerId = 'phpantom' | 'typescript' | 'svelte' | 'html' | 'css' | 'tailwind';
|
|
2
|
+
export type ServerMode = 'bundled' | 'path';
|
|
3
|
+
export interface ServerConfig {
|
|
4
|
+
enabled?: boolean;
|
|
5
|
+
mode?: ServerMode;
|
|
6
|
+
command?: string;
|
|
7
|
+
args?: string[];
|
|
8
|
+
env?: Record<string, string>;
|
|
9
|
+
initializationOptions?: unknown;
|
|
10
|
+
configuration?: unknown;
|
|
11
|
+
}
|
|
12
|
+
export interface Config {
|
|
13
|
+
providerId?: string;
|
|
14
|
+
missingServerPolicy?: 'warn' | 'error';
|
|
15
|
+
limits?: {
|
|
16
|
+
maxDocumentBytes?: number;
|
|
17
|
+
maxMessageBytes?: number;
|
|
18
|
+
maxStderrBytes?: number;
|
|
19
|
+
};
|
|
20
|
+
timeouts?: {
|
|
21
|
+
navigationMs?: number;
|
|
22
|
+
primaryHoverMs?: number;
|
|
23
|
+
auxiliaryHoverMs?: number;
|
|
24
|
+
diagnosticsMs?: number;
|
|
25
|
+
completionMs?: number;
|
|
26
|
+
shutdownMs?: number;
|
|
27
|
+
killGraceMs?: number;
|
|
28
|
+
};
|
|
29
|
+
servers?: Partial<Record<ServerId, ServerConfig>>;
|
|
30
|
+
tailwind?: {
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
queryStrategy?: 'candidate' | 'always';
|
|
33
|
+
classAttributes?: string[];
|
|
34
|
+
classRegex?: Array<string | [string, string]>;
|
|
35
|
+
includeLanguages?: Record<string, string>;
|
|
36
|
+
};
|
|
37
|
+
routing?: {
|
|
38
|
+
bladeSuffixes?: string[];
|
|
39
|
+
tailwindLanguages?: string[];
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export interface ResolvedServerConfig {
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
mode: ServerMode;
|
|
45
|
+
command: string;
|
|
46
|
+
args: string[];
|
|
47
|
+
env: Record<string, string>;
|
|
48
|
+
initializationOptions?: unknown;
|
|
49
|
+
configuration?: unknown;
|
|
50
|
+
}
|
|
51
|
+
export interface ResolvedConfig {
|
|
52
|
+
providerId: string;
|
|
53
|
+
missingServerPolicy: 'warn' | 'error';
|
|
54
|
+
limits: {
|
|
55
|
+
maxDocumentBytes: number;
|
|
56
|
+
maxMessageBytes: number;
|
|
57
|
+
maxStderrBytes: number;
|
|
58
|
+
};
|
|
59
|
+
timeouts: {
|
|
60
|
+
navigationMs: number;
|
|
61
|
+
primaryHoverMs: number;
|
|
62
|
+
auxiliaryHoverMs: number;
|
|
63
|
+
diagnosticsMs: number;
|
|
64
|
+
completionMs: number;
|
|
65
|
+
shutdownMs: number;
|
|
66
|
+
killGraceMs: number;
|
|
67
|
+
};
|
|
68
|
+
servers: Record<ServerId, ResolvedServerConfig>;
|
|
69
|
+
tailwind: {
|
|
70
|
+
enabled: boolean;
|
|
71
|
+
queryStrategy: 'candidate' | 'always';
|
|
72
|
+
classAttributes: string[];
|
|
73
|
+
classRegex: Array<string | [string, string]>;
|
|
74
|
+
includeLanguages: Record<string, string>;
|
|
75
|
+
};
|
|
76
|
+
routing: {
|
|
77
|
+
bladeSuffixes: string[];
|
|
78
|
+
tailwindLanguages: string[];
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export declare const SERVER_IDS: ServerId[];
|
|
82
|
+
export declare const DEFAULT_CONFIG: ResolvedConfig;
|
|
83
|
+
export declare function resolveConfig(input?: unknown): ResolvedConfig;
|
|
84
|
+
export declare const ConfigSchema: {
|
|
85
|
+
readonly parse: typeof resolveConfig;
|
|
86
|
+
readonly validate: typeof resolveConfig;
|
|
87
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { LspError } from '@deepseek-ai/dsh-lsp';
|
|
2
|
+
export type WebstackErrorCode = 'LSP_UNAVAILABLE' | 'LSP_UNSUPPORTED_OPERATION' | 'LSP_DISPOSED' | 'LSP_MALFORMED_RESPONSE' | 'LSP_CONFLICT' | 'LSP_WORKSPACE_REQUIRED' | 'LSP_WEBSTACK_CONFIG_INVALID';
|
|
3
|
+
export declare class WebstackLspError extends LspError {
|
|
4
|
+
readonly code: WebstackErrorCode;
|
|
5
|
+
constructor(code: WebstackErrorCode, message: string, options?: ErrorOptions);
|
|
6
|
+
}
|
|
7
|
+
export declare function configError(message: string): WebstackLspError;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
3
|
+
import type { WebstackLspService } from './service.js';
|
|
4
|
+
export declare const name = "lsp_extra";
|
|
5
|
+
export declare const inject: string[];
|
|
6
|
+
export interface Config {
|
|
7
|
+
maxDiagnostics?: number;
|
|
8
|
+
maxCompletions?: number;
|
|
9
|
+
maxResultChars?: number;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function createExtraTool(service: WebstackLspService, config?: Config): ToolDefinition;
|
|
13
|
+
export declare function apply(ctx: Context, config?: Config): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FileSystem } from '@deepseek-ai/dsh-fs';
|
|
2
|
+
export type HostFileSystem = Pick<FileSystem, 'resolve' | 'stat' | 'processPath' | 'fileUrl' | 'contains' | 'streamText'>;
|
|
3
|
+
export interface HostSource {
|
|
4
|
+
workspace: string;
|
|
5
|
+
workspaceUri: string;
|
|
6
|
+
key: string;
|
|
7
|
+
uri: string;
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function readSource(fs: HostFileSystem, workspaceRoot: string, filePath: string, maxBytes: number, signal?: AbortSignal): Promise<HostSource>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CanonicalWorkspace, WorkspaceFileSystem } from './workspace.js';
|
|
2
|
+
export interface SourceReader {
|
|
3
|
+
read(workspace: CanonicalWorkspace, filePath: string, maxDocumentBytes: number): Promise<{
|
|
4
|
+
path: string;
|
|
5
|
+
text: string;
|
|
6
|
+
}>;
|
|
7
|
+
}
|
|
8
|
+
export declare function createSourceReader(fs: WorkspaceFileSystem): SourceReader;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface WorkspaceFileSystem {
|
|
2
|
+
realpath(path: string): Promise<string>;
|
|
3
|
+
stat(path: string): Promise<{
|
|
4
|
+
isFile(): boolean;
|
|
5
|
+
}>;
|
|
6
|
+
readFile(path: string): Promise<Uint8Array | string>;
|
|
7
|
+
}
|
|
8
|
+
export interface CanonicalWorkspace {
|
|
9
|
+
root: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function canonicalizeWorkspace(fs: WorkspaceFileSystem, root: string): Promise<CanonicalWorkspace>;
|
|
12
|
+
export declare function resolveWorkspaceSource(fs: WorkspaceFileSystem, workspace: CanonicalWorkspace, filePath: string, maxDocumentBytes: number): Promise<{
|
|
13
|
+
path: string;
|
|
14
|
+
text: string;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function isContained(root: string, candidate: string): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CompletionResult, NormalizedCompletionItem } from '../service.js';
|
|
2
|
+
export interface CompletionMergeLimits {
|
|
3
|
+
maxCompletions: number;
|
|
4
|
+
maxResultChars: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function mergeCompletions(groups: ReadonlyArray<ReadonlyArray<NormalizedCompletionItem>>, limits: CompletionMergeLimits): CompletionResult;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DiagnosticsResult, NormalizedDiagnostic } from '../service.js';
|
|
2
|
+
export interface DiagnosticMergeLimits {
|
|
3
|
+
maxDiagnostics: number;
|
|
4
|
+
maxResultChars: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function mergeDiagnostics(groups: ReadonlyArray<ReadonlyArray<NormalizedDiagnostic>>, limits: DiagnosticMergeLimits): DiagnosticsResult;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { NormalizedHover } from '../protocol/normalize-hover.js';
|
|
2
|
+
export interface ServerHover extends NormalizedHover {
|
|
3
|
+
server: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function mergeHover(primary: ServerHover | null | undefined, auxiliary: ServerHover | null | undefined): ServerHover | null;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type StandardOperation = 'goToDefinition' | 'findReferences' | 'goToImplementation' | 'hover';
|
|
2
|
+
export declare function supportsOperation(capabilities: Record<string, unknown>, operation: StandardOperation): boolean;
|
|
3
|
+
export declare function defaultServerRequest(method: string, params: unknown): unknown;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { InitializeParams, InitializeResult } from './types.js';
|
|
2
|
+
import type { JsonRpcConnection } from '../runtime/connection.js';
|
|
3
|
+
export declare function initializeServer(connection: JsonRpcConnection, params: InitializeParams, signal?: AbortSignal): Promise<InitializeResult>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { NormalizedCompletionItem } from '../service.js';
|
|
2
|
+
export declare function normalizeCompletionItem(value: unknown, server: string): NormalizedCompletionItem | undefined;
|
|
3
|
+
export declare function normalizeCompletion(value: unknown, server: string): NormalizedCompletionItem[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { NormalizedDiagnostic } from '../service.js';
|
|
2
|
+
export declare function normalizeDiagnostic(value: unknown, server: string, fallbackUri: string): NormalizedDiagnostic | undefined;
|
|
3
|
+
export declare function normalizeDiagnostics(value: unknown, server: string, fallbackUri: string): NormalizedDiagnostic[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { LspRange } from '../service.js';
|
|
2
|
+
export interface NormalizedLocation {
|
|
3
|
+
uri: string;
|
|
4
|
+
range: LspRange;
|
|
5
|
+
}
|
|
6
|
+
export declare function normalizeLocation(value: unknown): NormalizedLocation | undefined;
|
|
7
|
+
export declare function normalizeLocations(value: unknown): NormalizedLocation[];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type JsonRpcId = string | number;
|
|
2
|
+
export interface JsonRpcRequest {
|
|
3
|
+
jsonrpc: '2.0';
|
|
4
|
+
id: JsonRpcId;
|
|
5
|
+
method: string;
|
|
6
|
+
params?: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface JsonRpcNotification {
|
|
9
|
+
jsonrpc: '2.0';
|
|
10
|
+
method: string;
|
|
11
|
+
params?: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface JsonRpcResponse {
|
|
14
|
+
jsonrpc: '2.0';
|
|
15
|
+
id: JsonRpcId;
|
|
16
|
+
result?: unknown;
|
|
17
|
+
error?: {
|
|
18
|
+
code: number;
|
|
19
|
+
message: string;
|
|
20
|
+
data?: unknown;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export type JsonRpcMessage = JsonRpcRequest | JsonRpcNotification | JsonRpcResponse;
|
|
24
|
+
export interface InitializeParams {
|
|
25
|
+
processId?: number | null;
|
|
26
|
+
rootUri?: string | null;
|
|
27
|
+
rootPath?: string | null;
|
|
28
|
+
capabilities?: Record<string, unknown>;
|
|
29
|
+
initializationOptions?: unknown;
|
|
30
|
+
workspaceFolders?: Array<{
|
|
31
|
+
uri: string;
|
|
32
|
+
name: string;
|
|
33
|
+
}>;
|
|
34
|
+
clientInfo?: {
|
|
35
|
+
name: string;
|
|
36
|
+
version?: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface InitializeResult {
|
|
40
|
+
capabilities: Record<string, unknown>;
|
|
41
|
+
serverInfo?: {
|
|
42
|
+
name: string;
|
|
43
|
+
version?: string;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export interface ConfigurationItem {
|
|
47
|
+
scopeUri?: string | null;
|
|
48
|
+
section?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ServerRequestHandler {
|
|
51
|
+
(method: string, params: unknown): Promise<unknown> | unknown;
|
|
52
|
+
}
|
|
53
|
+
export interface JsonRpcConnectionOptions {
|
|
54
|
+
maxMessageBytes: number;
|
|
55
|
+
onNotification?: (notification: JsonRpcNotification) => void;
|
|
56
|
+
onServerRequest?: ServerRequestHandler;
|
|
57
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { LspProvider, LspProviderQuery, LspQueryResult } from '@deepseek-ai/dsh-lsp';
|
|
3
|
+
import type { Config as PluginConfig, ResolvedConfig } from './config.js';
|
|
4
|
+
import type { WebstackLspService } from './service.js';
|
|
5
|
+
export type { LspProvider, LspProviderQuery, LspQueryResult };
|
|
6
|
+
export type Config = PluginConfig;
|
|
7
|
+
export declare const name = "lsp-webstack-provider";
|
|
8
|
+
export declare const inject: string[];
|
|
9
|
+
declare module '@deepseek-ai/cordis' {
|
|
10
|
+
interface Context {
|
|
11
|
+
webstackLsp: WebstackLspService;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export declare const OUTER_EXTENSION_MAP: {
|
|
15
|
+
readonly '.php': "php";
|
|
16
|
+
readonly '.ts': "typescript";
|
|
17
|
+
readonly '.tsx': "typescriptreact";
|
|
18
|
+
readonly '.mts': "typescript";
|
|
19
|
+
readonly '.cts': "typescript";
|
|
20
|
+
readonly '.js': "javascript";
|
|
21
|
+
readonly '.jsx': "javascriptreact";
|
|
22
|
+
readonly '.mjs': "javascript";
|
|
23
|
+
readonly '.cjs': "javascript";
|
|
24
|
+
readonly '.svelte': "svelte";
|
|
25
|
+
readonly '.html': "html";
|
|
26
|
+
readonly '.htm': "html";
|
|
27
|
+
readonly '.css': "css";
|
|
28
|
+
readonly '.pcss': "css";
|
|
29
|
+
};
|
|
30
|
+
export interface CompositeRuntime {
|
|
31
|
+
navigation(request: LspProviderQuery, signal?: AbortSignal): Promise<LspQueryResult>;
|
|
32
|
+
dispose?(): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
export declare function createCompositeProvider(runtime: CompositeRuntime, config?: Pick<ResolvedConfig, 'providerId'>): LspProvider;
|
|
35
|
+
export declare function apply(ctx: Context, config?: unknown): Promise<void>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type FileKind = 'blade' | 'php' | 'typescript' | 'typescriptreact' | 'javascript' | 'javascriptreact' | 'svelte' | 'html' | 'css';
|
|
2
|
+
export interface ClassifiedFile {
|
|
3
|
+
path: string;
|
|
4
|
+
basename: string;
|
|
5
|
+
suffix: string;
|
|
6
|
+
kind: FileKind;
|
|
7
|
+
}
|
|
8
|
+
export declare function classifyFile(filePath: string, bladeSuffixes?: string[]): ClassifiedFile | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ClassifiedFile } from './classifier.js';
|
|
2
|
+
import type { Route } from './route-table.js';
|
|
3
|
+
export declare function primaryLanguageId(route: Route): string;
|
|
4
|
+
export declare function languageIdForServer(route: Route, server: string): string | null;
|
|
5
|
+
export declare function classifyLanguage(file: ClassifiedFile, route: Route, server: string): string | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ServerId } from '../config.js';
|
|
2
|
+
import type { ClassifiedFile } from './classifier.js';
|
|
3
|
+
export interface Route {
|
|
4
|
+
primary: {
|
|
5
|
+
server: ServerId;
|
|
6
|
+
languageId: string;
|
|
7
|
+
};
|
|
8
|
+
auxiliary?: {
|
|
9
|
+
server: 'tailwind';
|
|
10
|
+
languageId: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare function routeFor(file: ClassifiedFile): Route;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function hasTailwindCandidate(source: string, line: number, classRegex?: Array<string | [string, string]>, character?: number, classAttributes?: string[]): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function abortError(): Error;
|
|
2
|
+
export declare function throwIfAborted(signal?: AbortSignal): void;
|
|
3
|
+
export declare function onAbort(signal: AbortSignal | undefined, callback: () => void): () => void;
|
|
4
|
+
export declare function withAbort<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Readable, Writable } from 'node:stream';
|
|
2
|
+
import type { JsonRpcConnectionOptions, JsonRpcNotification } from '../protocol/types.js';
|
|
3
|
+
export declare class JsonRpcConnection {
|
|
4
|
+
private readonly input;
|
|
5
|
+
private readonly output;
|
|
6
|
+
private readonly decoder;
|
|
7
|
+
private readonly pending;
|
|
8
|
+
private readonly notificationListeners;
|
|
9
|
+
private nextId;
|
|
10
|
+
private closed;
|
|
11
|
+
private requestHandler;
|
|
12
|
+
constructor(input: Readable, output: Writable, options: JsonRpcConnectionOptions);
|
|
13
|
+
get isOpen(): boolean;
|
|
14
|
+
onNotification(listener: (notification: JsonRpcNotification) => void): () => void;
|
|
15
|
+
setRequestHandler(handler: NonNullable<JsonRpcConnectionOptions['onServerRequest']>): void;
|
|
16
|
+
request(method: string, params?: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
17
|
+
notify(method: string, params?: unknown): Promise<void>;
|
|
18
|
+
close(reason?: Error): void;
|
|
19
|
+
private receive;
|
|
20
|
+
private dispatch;
|
|
21
|
+
private write;
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare class JsonRpcFrameError extends Error {
|
|
2
|
+
readonly code = "LSP_MALFORMED_RESPONSE";
|
|
3
|
+
constructor(message: string);
|
|
4
|
+
}
|
|
5
|
+
export declare class ContentLengthDecoder {
|
|
6
|
+
private readonly maxMessageBytes;
|
|
7
|
+
private buffer;
|
|
8
|
+
private readonly decoder;
|
|
9
|
+
constructor(maxMessageBytes: number);
|
|
10
|
+
feed(chunk: Uint8Array): unknown[];
|
|
11
|
+
end(): void;
|
|
12
|
+
private parseLength;
|
|
13
|
+
}
|
|
14
|
+
export declare function encodeJsonRpc(message: object): Buffer;
|