Skip to content

Commit

Permalink
pytest-lsp: Add checks for window/workDoneProgress/create
Browse files Browse the repository at this point in the history
  • Loading branch information
alcarney committed Nov 12, 2023
1 parent 57bf078 commit 021b9a5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/pytest-lsp/pytest_lsp/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,17 @@ def document_links(
assert tooltip_support, "Client does not support tooltips."


@check_params_of(method=types.WINDOW_WORK_DONE_PROGRESS_CREATE)
def work_done_progress_create(
capabilities: types.ClientCapabilities,
params: types.WorkDoneProgressCreateParams,
):
"""Assert that the client has support for ``window/workDoneProgress/create``
requests."""
is_supported = get_capability(capabilities, "window.workDoneProgress", False)
assert is_supported, "Client does not support 'window/workDoneProgress/create'"


@check_params_of(method=types.WORKSPACE_CONFIGURATION)
def workspace_configuration(
capabilities: types.ClientCapabilities,
Expand Down
8 changes: 8 additions & 0 deletions lib/pytest-lsp/tests/test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
@pytest.mark.parametrize(
"capabilities,method,params,expected",
[
(
types.ClientCapabilities(
window=types.WindowClientCapabilities(work_done_progress=False)
),
types.WINDOW_WORK_DONE_PROGRESS_CREATE,
types.WorkDoneProgressCreateParams(token="id-123"),
"does not support 'window/workDoneProgress/create'",
),
(
types.ClientCapabilities(
workspace=types.WorkspaceClientCapabilities(configuration=False)
Expand Down

0 comments on commit 021b9a5

Please sign in to comment.