Search packages, repositories and app categories

Package detailsv0.4.0

lsp_server_ce

A Dart implementation of the Language Server Protocol. This package can be used to implement a server that supports the Language Server Protocol.

AndroidiOSLinuxmacOSWebWindows
30-day downloads
64.2K
Likes
0
Pub points
130

Install package

flutter pub add lsp_server_ce

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Dart implementation of the Language Server Protocol (LSP), enabling developers to build language servers that provide features like code completion, diagnostics, and refactoring across editors and IDEs. This package supports all major platforms and integrates seamlessly with Flutter projects. It is designed for tooling authors who want to extend language capabilities in text editors using LSP standards.

Use cases

  • Building custom language servers for Dart or other languages
  • Integrating advanced code intelligence into IDEs
  • Enabling real-time syntax checking and suggestions
  • Creating editor extensions with rich language features
  • Supporting multi-platform development workflows

Key features

  • Full LSP specification compliance
  • Cross-platform support (Android, iOS, Linux, macOS, Web, Windows)
  • Easy integration with Flutter apps
  • Modular design for extensible language server logic
  • Built-in handling of LSP messages and communication protocols

Suitable for

  • Dart tooling developers
  • IDE plugin creators
  • Language feature implementers
  • Code analysis tool builders
  • Multi-platform development teams

Considerations

  • Requires understanding of the Language Server Protocol
  • May need additional setup for complex language features
  • Best suited for developers familiar with server-client communication patterns
  • Not intended for end-user applications directly
  • Depends on proper configuration for editor compatibility

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

LSP Server

This is a dart implementation of the Language Server Protocol and comes with all serializable objects defined in the specification (v3.17).

The interface also contains the event methods for Document synchronization as well as the Language Features.

Features

  • Life cycle methods

  • Language features

  • Generic registration of listeners for events and methods.

  • Generic methods to send events and requests

Getting started

To get a better understanding of how this work it can be useful to look at the official documentation and the similar implementations in node.

Full LSP spec definition.

LSP Guide for vscode.

LSP Example for vscode.

Usage

You can use any stream you want, stdio is commonly used and is easy to set up.

void main() async {
  // Create a connection that can read and write data to the LSP client.
  // Supply a readable and writable stream. In this case we are using stdio.
  // But you could use a socket connection or any other stream.
  var connection = Connection(stdin, stdout);

  // Register a listener for when the client initialzes the server.
  // You are suppose to respond with the capabilities of the server.
  // Some capabilities must be enabled by the client, you can see what the client
  // supports by inspecting the ClientCapabilities object, inside InitializeParams.
  connection.onInitialize((params) async {
    return InitializeResult(
      capabilities: ServerCapabilities(
        // In this example we are using the Full sync mode. This means the
        // entire document is sent in each change notification.
        textDocumentSync: const Either2.t1(TextDocumentSyncKind.Full),
      ),
    );
  });
}

Additional information

Who should use this? If you want to build a plugin for an editor that supports the LSP format, and you want to build the server in Dart, then this is the package for you. With this package you can implement features such as "linting", "go to reference", giving contextual information and more.

Todo

Implement the missing features from the protocol:

  • workspaces
  • window
  • notebook
  • client (dynamic capabilities)
  • trace

Categories

Dependencies

Dependency list 8 items

Source repository

Projects using this package

No data available yet.

Rankings