Skip to content
pubscout

lsp_server

0.4.0, released a year ago by serverpod.dev

Dart implementation of the Language Server Protocol for building LSP servers.

WASM-ready
$ flutter pub add lsp_server
Source repository

What it does

Provides a fully spec‑compliant LSP server implementation with generic event registration and request handling. It includes all serializable objects from the LSP v3.17 spec and supports document synchronization and language features.

AI-written summary of version 0.4.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Building a language server for a Dart/Flutter editor plugin
  • Implementing custom LSP features like linting or go‑to‑definition
  • Creating a standalone LSP server for tooling

Skip it when

  • Using it as a client‑side library for consuming LSP services
  • Relying on it for production‑grade editor extensions that require full protocol support yet to be implemented

Strengths

  • Full LSP v3.17 spec support
  • Stream‑based API for easy integration with stdio or sockets
  • Generic listener registration for events and methods

Weaknesses

  • Missing protocol features (workspaces, window, notebook, etc.)
  • No built‑in UI or editor integration
  • Requires manual setup of streams

Setup

Kind
Pure Dart
Effort
Medium
Code generation
No
Direct dependencies
9

Create a Connection with stdin/stdout or a custom stream, register listeners, and call listen()

void main() async {
  var connection = Connection(stdin, stdout);
  connection.onInitialize((params) async {
    return InitializeResult(
      capabilities: ServerCapabilities(
        textDocumentSync: const Either2.t1(TextDocumentSyncKind.Full),
      ),
    );
  });
  await connection.listen();
}

Alternatives

Packages that do the same job and could replace lsp_server.

Works with

Packages commonly used together with lsp_server: ones it builds on, ones built on it, and its own family.