Repository navigation
Add a low-level LanguageServer.send example to the README - #172
Open
Puliuvarthi.Mahesh (MaheshPulivarthi18) wants to merge 1 commit into
Conversation
Show how to send LSP requests that SyncLanguageServer does not wrap by calling language_server.server.send from the server's event loop. Closes microsoft#89. Generated by NightShift
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #89.
SyncLanguageServeronly wraps a few LSP requests, and the docs did not show how to issue any other request. This adds a short README section showing how to calllsp.language_server.server.send.<method>from synchronous code.The example:
open_filebefore sending the request.asyncio.run_coroutine_threadsafe(..., lsp.loop)and waits withlsp.timeout.definitionanddeclarationas the sample requests, through one shared helper rather than two copies.The section also notes that
sendresults are raw LSP JSON values rather thanmultilspytypes, and that the exact result depends on the language server.The example in the issue called
send.declarationin both its definition and declaration functions; heredefinitionanddeclarationare each called by name.For reviewers: this is a docs-only change. The code sample has not been run against a live language server as part of this PR.
Documentation-only change (
README.md).Existing suites:
find tests/multilspy -ipath '*python*' -name 'test_*.py' | xargs .venv/bin/pytest -q --tb=short -p no:cacheprovider: passed