From 6b975be4de2697979ee8039a59d84cfd7923c827 Mon Sep 17 00:00:00 2001 From: Stephen Macke Date: Sun, 8 Oct 2023 18:19:07 -0700 Subject: [PATCH] Fix notebook document selector not being a list in capabilities (#454) --- pylsp/python_lsp.py | 2 +- test/test_notebook_document.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pylsp/python_lsp.py b/pylsp/python_lsp.py index 3eeb2f7f..e2b541d5 100644 --- a/pylsp/python_lsp.py +++ b/pylsp/python_lsp.py @@ -295,7 +295,7 @@ def capabilities(self): "openClose": True, }, "notebookDocumentSync": { - "notebookSelector": {"cells": [{"language": "python"}]} + "notebookSelector": [{"cells": [{"language": "python"}]}] }, "workspace": { "workspaceFolders": {"supported": True, "changeNotifications": True} diff --git a/test/test_notebook_document.py b/test/test_notebook_document.py index e8e7ac75..6050b58f 100644 --- a/test/test_notebook_document.py +++ b/test/test_notebook_document.py @@ -33,7 +33,8 @@ def test_initialize(client_server_pair): }, ).result(timeout=CALL_TIMEOUT_IN_SECONDS) assert server.workspace is not None - assert "notebookDocumentSync" in response["capabilities"].keys() + selector = response["capabilities"]["notebookDocumentSync"]["notebookSelector"] + assert isinstance(selector, list) @pytest.mark.skipif(IS_WIN, reason="Flaky on Windows")