Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to std::future and async/await #101

Merged
merged 9 commits into from
Feb 22, 2020
Merged

Conversation

ebkalderon
Copy link
Owner

@ebkalderon ebkalderon commented Feb 22, 2020

Added

Changed

  • Convert to std::future::Future and async/await (use new futures, tokio, tower-service).
  • Update minimum supported Rust version in CI to 1.39.0.
  • Add Unpin bound to stdout parameter in Server.
  • Update README.md, use glob imports in examples.
  • Remove unnecessary Deserialize derive in example.
  • Drop patch versions from dependencies in Cargo.toml.

Fixed

  • Improve docs consistency for Printer::send_notification().

Removed

  • Remove 'static bound for stdin parameter in Server.

This closes #58, closes #64, closes #90, closes #91, closes #96, and closes #97.

This commit makes judicious use of `compat()` to convert between
`std::future::Future` and the legacy `futures` 0.1 `Future` trait such
that we can have native Rust async/await support without waiting for the
`jsonrpsee` crate to be ready (see #58 for context).

Naturally, this should be considered a breaking change for this library
since it directly affects the public API for this crate, and it also
increases the minimum supported Rust version to 1.39.0. It tentatively
introduces a reliance on [`async-trait`] for the `LanguageServer` trait
and it also relaxes the `'static` requirements for the `stdin` parameter
for `Server`.

[`async-trait`]: https://github.com/dtolnay/async-trait

This does not yet resolve #13, since that would require either
switching to `jsonrpsee`, once it's ready, or building a custom client
solution for the `Printer`, converting it to a `Client` or similar.
According to semantic versioning rules, we should be capable of
compiling with any crate that is at least minor-version compatible with
our requirements. Retaining the patch versions here creates a lot of
unnecessary work for Dependabot and requires the maintainer to manually
bump the versions through PRs. With this change, this will no longer be
necessary for patch version changes, which will be applied to
`tower-lsp` automatically where applicable by Cargo.
@ebkalderon ebkalderon self-assigned this Feb 22, 2020
@ebkalderon ebkalderon merged commit 13b31f3 into master Feb 22, 2020
@ebkalderon ebkalderon deleted the convert-to-async-await branch February 22, 2020 18:22
@ebkalderon
Copy link
Owner Author

Since this pull request closes #101 but does not yet convert the library to use jsonrpsee, I will open a separate issue tracking that conversion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert to std::future and async/await
1 participant