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

Add example semantic tokens server #484

Merged
merged 4 commits into from
Jul 16, 2024

Conversation

alcarney
Copy link
Collaborator

@alcarney alcarney commented Jul 16, 2024

Description (e.g. "Related to ...", etc.)

image

This adds an example semantic tokens server, replacing the existing half implementation we have in the json_server.py example. That said, it's still only semantic tokens "level one" - there is still the range based method and delta updates to consider! 😅

Unlike most other methods semantic tokens are quite obtuse, for example, here is the result the server sent when highlighting the code in the above screenshot

{"id": 2, "jsonrpc": "2.0", "result": {"data": [0, 0, 4, 0, 0, 0, 5, 9, 5, 8, 0, 9, 1, 3, 0, 0, 1, 1, 1, 0, 0, 1, 1, 3, 0, 0, 2, 1, 1, 0, 0, 1, 1, 3, 0, 0, 2, 1, 1, 0, 0, 1, 1, 3, 0, 0, 2, 1, 1, 0, 0, 1, 1, 3, 0, 0, 2, 1, 3, 0, 0, 2, 1, 3, 0, 0, 1, 1, 4, 0, 0, 1, 1, 3, 0, 0, 2, 1, 1, 0, 0, 1, 1, 3, 0, 0, 2, 1, 4, 0, 0, 1, 1, 3, 0, 0, 2, 1, 1, 0, 0, 1, 1, 3, 0, 0, 2, 5, 4, 0, 0, 5, 1, 3, 0, 0, 2, 1, 1, 0, 0, 1, 1, 3, 0, 0, 2, 6, 4, 0, 0, 6, 1, 3, 0, 0, 2, 1, 1, 0, 0, 2, 1, 3, 0, 1, 0, 4, 0, 0, 0, 5, 6, 5, 8, 0, 6, 1, 3, 0, 0, 1, 1, 1, 0, 0, 1, 1, 3, 0, 0, 2, 1, 1, 0, 0, 1, 1, 3, 0, 0, 2, 1, 1, 0, 0, 1, 1, 3, 0, 0, 2, 1, 3, 0, 0, 2, 9, 5, 0, 0, 9, 1, 3, 0, 0, 1, 1, 1, 0, 0, 1, 1, 3, 0, 0, 2, 1, 1, 0, 0, 1, 1, 3, 0, 0, 2, 1, 1, 0, 0, 1, 1, 3, 0, 0, 2, 1, 1, 0, 0, 1, 1, 3, 0, 2, 0, 2, 0, 0, 0, 3, 4, 2, 8, 0, 4, 1, 3, 0, 0, 1, 4, 1, 0, 0, 4, 1, 3, 0, 0, 2, 9, 5, 0, 0, 9, 1, 3, 0, 0, 2, 2, 3, 0, 0, 3, 4, 1, 0, 0, 4, 1, 3, 0, 0, 1, 5, 1, 0, 0, 6, 1, 3, 0, 0, 2, 4, 1, 0, 0, 4, 1, 3, 0, 0, 1, 6, 1, 0, 2, 0, 2, 0, 0, 0, 3, 6, 2, 8, 0, 6, 1, 3, 0, 0, 1, 4, 1, 0, 0, 4, 1, 3, 0, 0, 2, 9, 5, 0, 0, 9, 1, 3, 0, 0, 2, 6, 1, 0, 0, 6, 1, 3, 0, 0, 2, 5, 5, 4, 0, 5, 1, 3, 0, 0, 2, 2, 3, 0, 0, 3, 4, 2, 8, 0, 4, 1, 3, 0, 0, 1, 4, 1, 0, 0, 4, 1, 3, 0, 0, 2, 1, 3, 0, 0, 2, 6, 1, 0]}}

So this PR also includes an accompanying how to guide containing some interactive demos that (hopefully!) help explain what's going on

image

Code review checklist (for code reviewer to complete)

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Commit messages are meaningful (see this for details)
  • Tests have been included and/or updated, as appropriate
  • Docstrings have been included and/or updated, as appropriate
  • Standalone docs have been updated accordingly

Automated linters

You can run the lints that are run on CI locally with:

poetry install --all-extras --with dev
poetry run poe lint

alcarney added 2 commits July 16, 2024 18:58
This appears to fix debugging with the new workspace local version of the playground
@alcarney alcarney changed the title Semantic tokens Add example semantic tokens server Jul 16, 2024
@alcarney alcarney requested a review from tombh July 16, 2024 18:20
@alcarney alcarney marked this pull request as ready for review July 16, 2024 18:20
Copy link
Collaborator

@tombh tombh left a comment

Choose a reason for hiding this comment

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

Docs, tests, examples, deleted redundant code. chef's kiss 🧑‍🍳

@alcarney alcarney merged commit a6660c2 into openlawlibrary:main Jul 16, 2024
16 checks passed
@alcarney alcarney deleted the semantic-tokens branch July 16, 2024 18:31
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.

2 participants