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

Use lsp_types directly in sway-lsp tests instead of simulating a client with tower-lsp #4976

Merged
merged 25 commits into from
Aug 22, 2023

Conversation

JoshuaBatty
Copy link
Member

@JoshuaBatty JoshuaBatty commented Aug 18, 2023

Description

This PR removes the mock client <> server interaction to test the language server features in favour of using lsp_types directly. There are a few places like did_change where we are still using the exisiting framework, this is because we still rely on the tower-lsp event loop to synchronise notification messages. This will be tackled with the custom event loop work. Should be easy to just update the remaining tests here within that PR. I've also kept the publish diagnostics test the same as we still rely on the Client from tower-lsp for that functionality.

There were also a few tests here that were unnecessary. Namely, initialized initializes_only_once shutdown refuses_requests_after_shutdown. These tests are actually duplicated from tower-lsp itself, so there is really no reason we need to run them again in sway-lsp.

working towards #4958

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@JoshuaBatty JoshuaBatty self-assigned this Aug 18, 2023
@JoshuaBatty JoshuaBatty added language server LSP server testing General testing labels Aug 18, 2023
@JoshuaBatty JoshuaBatty marked this pull request as draft August 18, 2023 05:00
@JoshuaBatty JoshuaBatty marked this pull request as ready for review August 21, 2023 02:14
@JoshuaBatty JoshuaBatty requested review from a team August 21, 2023 02:14
@JoshuaBatty JoshuaBatty enabled auto-merge (squash) August 21, 2023 02:14
@JoshuaBatty JoshuaBatty requested a review from a team August 21, 2023 09:47
Copy link
Member

@sdankel sdankel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to have this decoupling! LGTM

@JoshuaBatty JoshuaBatty merged commit 7629126 into master Aug 22, 2023
30 checks passed
@JoshuaBatty JoshuaBatty deleted the josh/lsp_testing_framework branch August 22, 2023 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
language server LSP server testing General testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants