Skip to content

Lewin671/lsp-client

Repository files navigation

Universal LSP Client SDK

A TypeScript SDK for building Language Server Protocol (LSP) clients that run in any environment (Node.js, Browser, Electron, VS Code, etc.).

Features

  • Universal: Decoupled from VS Code API. Runs anywhere.
  • Type-Safe: Built with TypeScript.
  • Pluggable Transports: Support for Stdio, IPC, WebSocket, and custom transports.
  • Flexible Architecture: Middleware, Plugins, and Host abstractions.

Installation

npm install @lewin671/lsp-client

Usage

Basic Example

import { LanguageClient, StdioTransport } from '@lewin671/lsp-client';

// 1. Create a transport (e.g., Stdio for a local server)
const transport = new StdioTransport('path/to/server-executable', ['--stdio']);

// 2. Initialize the client
const client = new LanguageClient({
    name: 'My Language Client',
    transport: transport,
    // ... other options
});

// 3. Start the client
await client.start();

// 4. Send a request
const result = await client.sendRequest('textDocument/hover', { ... });

Architecture

See Agents.md for architectural details.

Development

Build

npm install
npm run build

Run Demo

npm run demo

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors