From 2d2e776d36f0fe8306fee2340bc09536e9516a73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= Date: Sun, 3 Apr 2022 12:11:40 +0900 Subject: [PATCH] json-extension: use an unique token for progress example The spec [1] and pygls implementation [2] needs the token to be unique. By using an hardcoded token like this, the progress works only one time, the second time there's an error that token is already registered. 1: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#serverInitiatedProgress 2: https://github.com/openlawlibrary/pygls//blob/ee17487e4f40f971e7ec6f7711fa8334c5b7b127/pygls/progress.py#L28 --- examples/json-extension/server/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/json-extension/server/server.py b/examples/json-extension/server/server.py index f6ca93fb..ffb081c8 100644 --- a/examples/json-extension/server/server.py +++ b/examples/json-extension/server/server.py @@ -197,7 +197,7 @@ def semantic_tokens(ls: JsonLanguageServer, params: SemanticTokensParams): @json_server.command(JsonLanguageServer.CMD_PROGRESS) async def progress(ls: JsonLanguageServer, *args): """Create and start the progress on the client.""" - token = 'token' + token = str(uuid.uuid4()) # Create await ls.progress.create_async(token) # Begin