From lsp-refactor
Documentation site for lspeasy Use when: You are building a browser-based LSP client, a WebSocket-backed language....
How this skill is triggered — by the user, by Claude, or both
Slash command
/lsp-refactor:lspeasy-coreThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Documentation site for lspeasy
references/classes.mdreferences/config.mdreferences/functions/discover.mdreferences/functions/document.mdreferences/functions/json-rpc.mdreferences/functions/middleware.mdreferences/functions/protocol/client-supports-notification.mdreferences/functions/protocol/client-supports-request.mdreferences/functions/protocol/create-did-change-watched-files-params.mdreferences/functions/protocol/create-file-event.mdreferences/functions/protocol/create-file-system-watcher.mdreferences/functions/protocol/create-partial-result-params.mdreferences/functions/protocol/create-progress-begin.mdreferences/functions/protocol/create-progress-create-params.mdreferences/functions/protocol/create-progress-end.mdreferences/functions/protocol/create-progress-report.mdreferences/functions/protocol/create-progress-token.mdreferences/functions/protocol/create-workspace-folder.mdreferences/functions/protocol/create-workspace-folders-change-event.mdreferences/functions/protocol/get-capability-for-notification-method.mdDocumentation site for lspeasy
@lspeasy/core is the shared foundation for the lspeasy SDK. It contains
everything needed to build custom LSP integrations, and re-exports the
most-used pieces from @lspeasy/client and @lspeasy/server.
JSON-RPC 2.0 — Message types (RequestMessage, NotificationMessage, ResponseMessage), framing (parseMessage, serializeMessage), and Zod schemas for validation.
Transports — The Transport interface plus browser-compatible
implementations: WebSocketTransport, DedicatedWorkerTransport,
SharedWorkerTransport.
Node.js transports (StdioTransport, TcpTransport, IpcTransport) are
in @lspeasy/core/node to avoid importing Node.js builtins in browsers.
| Need | Transport | Critical Gotcha |
|---|---|---|
| Spawn server as child process | StdioTransport | ConsoleLogger corrupts stdout — use NullLogger |
| Browser or remote server | WebSocketTransport | Call send() only after isConnected() is true |
| Persistent local daemon | TcpTransport | Create a new server instance per client reconnect |
| In-process browser isolation | DedicatedWorkerTransport | Monitor worker.onerror; crashes are silent |
| Shared worker, multiple tabs | SharedWorkerTransport | One worker handles all port connections |
Middleware — The Middleware pipeline runs on every client-to-server and server-to-client message. Use createScopedMiddleware to limit a middleware to specific methods, and createTypedMiddleware for full param/result type inference.
LSP protocol — LSPRequest and LSPNotification namespaces expose every standard LSP method with its params and result types. LSPRequestMethod / LSPNotificationMethod are the union types for string-literal method names.
Utilities — CancellationTokenSource for request cancellation, DisposableStore for lifecycle management, ResponseError for structured JSON-RPC errors, DocumentVersionTracker for document sync.
Use this skill when:
WebSocketTransportDisposableStore — collect them all into one store and dispose the store on shutdown or feature toggle.MethodNotFound when a capability was not declared, or InvalidParams when schema validation fails). → use ResponseErrortextDocument/didChange notifications and need to track per-document version counters. → use DocumentVersionTrackerDo NOT use when:
StdioTransport (from @lspeasy/core/node) is the conventional choice and avoids the overhead of a network stack. For same-process workers prefer DedicatedWorkerTransport or SharedWorkerTransport. (WebSocketTransport)Error and handle it via server.onError() instead. (ResponseError)API surface: 62 functions, 11 classes, 122 types, 1 enums, 106 constants
null silently when no lsp.json is found anywhere in the search path (including the global ~/.claude/lsp.json fallback). Callers that skip the null check will silently fail to resolve a server command — for the CLI this means lsproxy exits before the proxy daemon is ever spawned. Create an lsp.json at the workspace root or at ~/.claude/lsp.json for a per-user fallback.null silently when no matching entry is found. The proxy daemon's BackendPool calls this function on every new language connection — if lsp.json is absent or omits the requested language, the daemon starts successfully but throws "No LSP server configured for languageId" the moment a client request arrives. An lsp.json must be present in the workspace (or at ~/.claude/lsp.json) before the proxy server can serve any language.enableReconnect: true in server mode (socket provided) — the option is silently ignored (reconnect has no URL to reconnect to), but the intent is misleading and suggests lifecycle management will be handled when it is not.isConnected() returns true. In client mode the socket is in CONNECTING state immediately after construction; send() will throw until the open event fires.ConsoleLogger in a stdio LSP server (StdioTransport) — the LSP base protocol uses stdout as the message channel. Any console.log / console.info / console.debug output will corrupt the stdio stream. Use NullLogger or a file-based logger instead, and send diagnostic messages via window/logMessage notifications.ResponseError with a code outside the defined ranges without documenting it. Undocumented codes are opaque to clients and tools.textDocument/didChange with the same version number as a previous change for the same document. The server may reject the change as a no-op or apply it out of order, causing text state desync.4 configuration interfaces — see references/config.md for details.
Key functions: isRequestMessage (Returns true when message is a JSON-RPC request (has id + method)), isNotificationMessage (Returns true when message is a JSON-RPC notification (has method,
no id)), isResponseMessage (Returns true when message is a JSON-RPC response (has id, no method)), isSuccessResponse (Returns true when response carries a result (success case)), isErrorResponse (Returns true when response carries an error (error case)), parseMessage (Parses a single framed JSON-RPC 2), serializeMessage (Serializes a JSON-RPC 2), createWebSocketClient (Creates a WebSocket client instance, preferring the native
globalThis), composeMiddleware(Combines multiple middleware functions into a single middleware that runs them left-to-right, each delegating to the next vianext()), executeMiddlewarePipeline(Runs the registered middleware chain for a single JSON-RPC message, then callsfinalHandlerif no middleware short-circuits),createScopedMiddleware(Wraps a middleware with a filter so it only runs for matching LSP messages),createTypedMiddleware(Creates a typed, method-scoped middleware with full TypeScript inference for the message params and result),createFullDidChangeParams(BuildsDidChangeTextDocumentParamsfor a full-document text replacement),createIncrementalDidChangeParams(BuildsDidChangeTextDocumentParamsfor an incremental (range-based) document change notification),createProgressBegin(Creates aWorkDoneProgressBeginpayload to start a work-done progress notification),createProgressReport(Creates aWorkDoneProgressReportpayload to update an in-progress work-done notification),buildMethodSets(Builds the full set of LSP methods and the subset that are always allowed (not gated by a capability) for a given capability key),discoverServer(Walk the directory tree fromrootto the filesystem root, checkinglsp), discoverServerByLanguageId (Walk the directory tree from root looking for a lsp) **Key classes:** WebSocketTransport(WebSocket-based transport for LSP communication),DisposableStore(Collects multipleDisposableinstances and releases them together),CancellationTokenSource(Controller that creates and manages aCancellationToken), ConsoleLogger(Logger implementation that writes to the process console with level filtering),NullLogger(No-op logger that silently discards all messages),ResponseError(AnErrorsubclass that maps to a JSON-RPC 2),DocumentVersionTracker` (Tracks monotonically increasing version numbers for open text documents)
302 exports total — see references/ for full API.
Load these on demand — do NOT read all at once:
references/functions/ for grouped indexes, full signatures, parameters, and return typesreferences/classes.md for properties, methods, and inheritancereferences/types.mdreferences/variables.mdreferences/config.md for all settings and defaultsnpx claudepluginhub pradeepmouli/lspeasy --plugin lsp-refactorCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.