Skip to content

Commit

Permalink
types: fix WorkDoneProgressOptions.workDoneProgress type
Browse files Browse the repository at this point in the history
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:
 - microsoft/vscode-languageserver-node#528 (comment)
 - microsoft/vscode#105870
  • Loading branch information
perrinjerome committed Jul 10, 2022
1 parent d538899 commit ff3ead8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pygls/lsp/types/basic_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ class WorkDoneProgressParams(Model):


class WorkDoneProgressOptions(Model):
work_done_progress: Optional[ProgressToken]
work_done_progress: Optional[bool]


class PartialResultParams(Model):
Expand Down
4 changes: 2 additions & 2 deletions tests/lsp/test_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit ff3ead8

Please sign in to comment.