pro_lsp 0.1.0 copy "pro_lsp: ^0.1.0" to clipboard
pro_lsp: ^0.1.0 copied to clipboard

Unified LSP 3.17 Dart bindings and client/server API implementation

example/main.dart

import 'package:pro_lsp/pro_lsp.dart';

void main() async {
  // Create a new LspServer instance
  final server = LspServer();

  // 1. Connection Initialization (mandatory step in the LSP handshake)
  server.general.onInitialize((params, context) async => const InitializeResult(
        capabilities: ServerCapabilities(
          hoverProvider: .bool(true),
        ),
        serverInfo: (name: 'example-server', version: '1.0.0'),
      ));

  // 2. Register a Hover Handler
  server.textDocument.onHover((params, context) async => Hover(
        contents: HoverContents.markupContent(
          MarkupContent(
            kind: .markdown,
            value: '### Example Hover\n\n'
                'This is a mock hover reply from the example server.\n'
                'Target Document: `${params.textDocument.uri}`',
          ),
        ),
      ));

  // 3. Start listening on standard I/O (stdin/stdout)
  await server.listen();
}
1
likes
0
points
870
downloads

Publisher

verified publisherpro100.dev

Weekly Downloads

Unified LSP 3.17 Dart bindings and client/server API implementation

Repository (GitHub)
View/report issues

Topics

#lsp #language-server #ide #editor #protocol

License

unknown (license)

Dependencies

freezed_annotation, json_annotation, json_rpc_2, stream_channel

More

Packages that depend on pro_lsp