lsp-client
Language server client over stdio JSON-RPC — framing, lifecycle, UTF-16 column conversion, on-demand spawn, and fail-closed behaviour.
- License 许可
- MIT
- 所属仓库
- poppyTM/oride
- 最近更新
- 2026-09-30
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- lsp-client
- description
- Language server client over stdio JSON-RPC — framing, lifecycle, UTF-16 column conversion, on-demand spawn, and fail-closed behaviour.
03 SKILL.md 正文
LSP Client
Purpose
Obtain language intelligence from a server the editor does not own. The server is a third-party process that may be missing, slow, crash, or speak a version the client did not expect. None of those may take the editor down.
Framing
Content-Length framing over stdio, with the header parser tolerant of the order and case real servers emit. A malformed frame is a protocol error to report, not a reason to panic or to resynchronise blindly into the middle of a message.
Lifecycle
- One client per language per workspace. Two servers for the same language is a bug that shows up as duplicated diagnostics.
- Spawned on demand, when a document of that language opens — not at startup.
initializecompletes before any request that needs capabilities; the client tracks the negotiated capability set and does not send requests the server declared unsupported.- Shutdown is graceful, with a bounded wait, then terminated. A server left running after the editor exits holds locks and ports.
- Crashes are contained: the client reports unavailability for that language and the editor keeps working without intelligence for it.
Position conversion — the classic silent corruption
LSP counts UTF-16 code units. A caret counts runes, and the buffer counts bytes. Three units, three conversions, and getting one wrong corrupts text at the first emoji or astral character.
- Conversion lives in one place and is covered by tests with surrogate pairs, CJK, combining marks and RTL.
- Positions from the server are clamped to the document; a server may report a position past the end and the editor must not panic.
TextEditapplication is ordered by position and applied from the end backwards, so earlier edits do not invalidate later offsets.
Fail closed
Missing binary, failed handshake, timeout, crash: each produces a status the user can read and an editor that still edits. Never a crash, never a silent hang, never a feature that appears to work and does nothing.
Sharing
Language intelligence is expensive. Before spawning, check whether an equivalent server is already running for this workspace; do not duplicate a server the harness already owns.
Verification
- A stub server drives the handshake, a diagnostic push, a completion and an edit round-trip, without depending on any real server being installed.
- A test asserts the client survives a server that closes mid-message.
04 同仓库更多 Skills
zoom-reflow
暂无简介
wireframe-styleguide
暂无简介
visual-regression
Pixel-by-pixel snapshot testing, Playwright integration, dynamic content masking, deterministic font rendering, and cross-browser CI gates
ui-implementation
Component-driven UI implementation, multi-state matrix (default, hover, focus-visible, active, disabled, loading, empty, error), DTCG design tokens, responsive layout contracts, and accessibility tree mapping.
tui-editor-engine
Text buffer and editing semantics for a terminal code editor — index conversion, transaction-first editing, multi-cursor invariants, undo grouping, and large-file behaviour.
tree-sitter-context-indexing
暂无简介