lsp_client 0.1.2 copy "lsp_client: ^0.1.2" to clipboard
lsp_client: ^0.1.2 copied to clipboard

A client with a small subset of Language Server Protocol to work with a local Dart LSP server

example/lib/main.dart

import 'dart:io';

import 'package:lsp_client/lsp_client.dart';

Future<void> main() async {
  final pwd = Directory.current.path;

  final client = LspClient();
  await client.start();

  await client.initialize(
    InitializeParams(
      rootUri: 'file://$pwd',
      capabilities: const ClientCapabilities(
        experimental: {
          'supportsDartTextDocumentContentProvider': true,
        },
      ),
    ),
  );

  final initializedFuture = client.initialized();
  final analyzedFuture = client.awaitAnalyzed();
  await (initializedFuture, analyzedFuture).wait;

  final contentResult = await client.dartTextDocumentContent(
    DartTextDocumentContentParams(
      uri: 'dart-macro+file://$pwd/lib/hello_client.dart',
    ),
  );

  print(contentResult.content); // ignore: avoid_print
  await client.dispose();
}
2
likes
150
pub points
6%
popularity

Publisher

verified publisherainkin.com

A client with a small subset of Language Server Protocol to work with a local Dart LSP server

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT-0 (license)

Dependencies

json_annotation, meta

More

Packages that depend on lsp_client