Closed alcarney closed 3 months ago
This is epic, so many useful examples and tests 🥰 I'll take a good long look soon.
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:
strftime
formatting for the date"The following seems to be a common pattern:
client, response = await get_client_for("...py")
yield client, response
await client.shutdown_async(None)
client.exit(None)
await client.stop()
To what extent can it be refactored?
assert test_uri is not None
live in the uri_for
function itself?Dwi'n dysgu am englyn yn fy dosbarthiau cymraeg ddiweddar. Yr PR yma yn atgoffa o y llinell glasurol:
Campwaith dewin hynod
🪄
Could assert test_uri is not None live in the uri_for function itself?
Yes, good spot
The following seems to be a common pattern: To what extent can it be refactored?
Perhaps get_client_for
can handle it and the fixture just becomes yield from get_client_for(...)
, I'll have a play and see if it will work
Turns out you can't yield from
an async generator, but an async for loop seems to work, so the fixtures now have the form
@pytest_asyncio.fixture()
async def json_server(get_client_for):
async for result in get_client_for("json_server.py"):
yield result
And what about linking each example server from the bottom of https://pygls.readthedocs.io/en/latest/pages/getting_started.html#quick-start?
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)