lsp_server
0.4.0, released a year ago by serverpod.dev
Dart implementation of the Language Server Protocol for building LSP servers.
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.
- webkit_inspection_protocol
A client for the Chrome DevTools Protocol to talk to debuggers.
50Compare - redux_remote_devtools
Remote DevTools for Redux.dart to inspect state changes during runtime.
43Compare
Works with
Packages commonly used together with lsp_server: ones it builds on, ones built on it, and its own family.
- pub_semverlsp_server depends on itVersions and version constraints implementing pub's versioning policy.
- dart_stylelsp_server depends on itProvides an API and CLI to format Dart source code automatically.
- asynclsp_server depends on itUtility classes and helpers that extend Dart's async library.
- argslsp_server depends on itLibrary for parsing raw command-line arguments into options and values using GNU and POSIX styles.
- stream_channellsp_server depends on itAn abstraction for two-way communication channels based on the Dart Stream class.
- serverpod_cliBuilt on lsp_serverCommand line tools for Serverpod.