From ff3ead8514b16fc7f7b3580f2f66a200c5369e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= Date: Sun, 10 Jul 2022 21:03:41 +0900 Subject: [PATCH] types: fix WorkDoneProgressOptions.workDoneProgress type It seems there was a confusing with WorkDoneProgressParams and WorkDoneProgressOptions. [WorkDoneProgressParams](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workDoneProgressParams) is the type used for the token in methods and notifications, it is the token itself, so it has type str | int. This type is correct, this was to explain context. [WorkDoneProgressOptions](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workDoneProgressOptions) is the type used for registration, it is used to indicate if work done progress are supported, so it is a boolean. This type was wrong. It seems as of today vscode does include workDoneProgress in requests: - https://github.com/microsoft/vscode-languageserver-node/issues/528#issuecomment-541600565 - https://github.com/microsoft/vscode/issues/105870 --- pygls/lsp/types/basic_structures.py | 2 +- tests/lsp/test_progress.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pygls/lsp/types/basic_structures.py b/pygls/lsp/types/basic_structures.py index 2b28b597..ba5038f2 100644 --- a/pygls/lsp/types/basic_structures.py +++ b/pygls/lsp/types/basic_structures.py @@ -472,7 +472,7 @@ class WorkDoneProgressParams(Model): class WorkDoneProgressOptions(Model): - work_done_progress: Optional[ProgressToken] + work_done_progress: Optional[bool] class PartialResultParams(Model): diff --git a/tests/lsp/test_progress.py b/tests/lsp/test_progress.py index e58117cc..01673af0 100644 --- a/tests/lsp/test_progress.py +++ b/tests/lsp/test_progress.py @@ -43,7 +43,7 @@ def __init__(self): @self.server.feature( CODE_LENS, CodeLensOptions(resolve_provider=False, - work_done_progress=PROGRESS_TOKEN), + work_done_progress=True), ) def f1(params: CodeLensParams) -> Optional[List[CodeLens]]: self.server.lsp.progress.begin( @@ -71,7 +71,7 @@ def test_capabilities(client_server): provider = capabilities.code_lens_provider assert provider - assert provider.work_done_progress == PROGRESS_TOKEN + assert provider.work_done_progress is True @ConfiguredLS.decorate()