-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add some example servers #440
Conversation
94e9a77
to
7846d31
Compare
This is epic, so many useful examples and tests 🥰 I'll take a good long look soon. |
7846d31
to
6b4ac79
Compare
Sorry for the delay, I've had a good look and think about this now. Again, really epic work here. This is so much more than just adding great new tests, it's self-documenting and generous to newcomers and experts alike. Also, as always, thank you so much for the self-contained commits, they really make understanding the changes here more digestible. I'd be happy to merge this as is! But here are some comments, they're very minor, so unless they resonate, don't worry about them:
Dwi'n dysgu am englyn yn fy dosbarthiau cymraeg ddiweddar. Yr PR yma yn atgoffa o y llinell glasurol:
🪄 |
Yes, good spot
Perhaps |
6b4ac79
to
5f5b47f
Compare
This commit refactors the infrastructure for writing end-to-end tests. There are now three fixtures `get_client_for` and `path_for` and `uri_for`, as the names suggest these are functions for obtaining a `LanguageClient` connected to a server in `examples/servers` and filepaths or URIs for files in `examples/servers/workspace`. This also adds a custom cli flag to our test suite - `--lsp-runtime` for choosing the runtime that the end-to-end tests are run against. Currently, the only supported runtime is `cpython` but this paves the way for other runtimes in the future (such as Pyodide or WASI)
5f5b47f
to
b46b87e
Compare
Turns out you can't @pytest_asyncio.fixture()
async def json_server(get_client_for):
async for result in get_client_for("json_server.py"):
yield result
I'll probably handle this in a separate PR - perhaps #427 |
Great 😊 |
I'm concious of the fact #418 is a rather large PR!
I've also realised that there's a growing amount of work in #418 that is not directly dependant on the new architecture.
So, this PR is a first pass at breaking some of that work out into a separate PR which we can merge now.
As part of refactoring the tests under
tests/lsp
to be end-to-end tests, I have been introducing small example servers which not only help with the tests, but which should help anyone new to pygls/lsp get to grips with how things work.This PR adds the following example servers:
code_lens.py
sums.txt
colors.py
colors.txt
goto.py
code.txt
hover.py
dates.txt
publish_diagnostics.py
sums.txt
pull_diagnostics.py
sums.txt
Side note: I'm thinking we should start moving away from
json_server.py
as our flagship example for two reasons.Code review checklist (for code reviewer to complete)