Skip to content

Commit 6c00bfc

Browse files
committed
Add notebookDocumentSync to capabilities
1 parent 7722239 commit 6c00bfc

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

pylsp/python_lsp.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ def capabilities(self):
268268
},
269269
'openClose': True,
270270
},
271-
'notebookDocumentSync' : {
271+
'notebookDocumentSync': {
272272
'notebookSelector': {
273-
'cells': [{ 'language': 'python' }]
273+
'cells': [{'language': 'python'}]
274274
}
275275
},
276276
'workspace': {
@@ -397,7 +397,7 @@ def _lint_text_document(self, doc_uri, workspace, is_saved):
397397
def _lint_notebook_document(self, notebook_document, workspace):
398398
"""
399399
Lint a notebook document.
400-
400+
401401
This is a bit more complicated than linting a text document, because we need to
402402
send the entire notebook document to the pylsp_lint hook, but we need to send
403403
the diagnostics back to the client on a per-cell basis.
@@ -486,7 +486,7 @@ def m_notebook_document__did_close(self, notebookDocument=None, cellTextDocument
486486
def m_notebook_document__did_change(self, notebookDocument=None, change=None, **_kwargs):
487487
"""
488488
Changes to the notebook document.
489-
489+
490490
This could be one of the following:
491491
1. Notebook metadata changed
492492
2. Cell(s) added

pylsp/workspace.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ def add_cells(self, new_cells: List, start: int) -> None:
505505
def remove_cells(self, start: int, delete_count: int) -> None:
506506
del self.cells[start:start+delete_count]
507507

508+
508509
# We inherit from Document for now to get the same API. However, cell document differ from the text documents in that
509510
# they have a language id.
510511
class Cell(Document):

test/test_notebook_document.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def client_server_pair():
5858
client_server_pair_obj.client._endpoint.notify("exit")
5959

6060

61-
def test_initialize(client_server_pair): # pylint: disable=redefined-outer-name
61+
def test_initialize(client_server_pair): # pylint: disable=redefined-outer-name
6262
client, server = client_server_pair
6363
response = client._endpoint.request(
6464
"initialize",
@@ -73,7 +73,7 @@ def test_initialize(client_server_pair): # pylint: disable=redefined-outer-name
7373
# TODO: assert that notebook capabilities are in response
7474

7575

76-
def test_notebook_document__did_open(client_server_pair): # pylint: disable=redefined-outer-name
76+
def test_notebook_document__did_open(client_server_pair): # pylint: disable=redefined-outer-name
7777
client, server = client_server_pair
7878
client._endpoint.request(
7979
"initialize",
@@ -157,7 +157,7 @@ def test_notebook_document__did_open(client_server_pair): # pylint: disable=rede
157157
mock_notify.assert_has_calls(expected_call_args)
158158

159159

160-
def test_notebook_document__did_change(client_server_pair): # pylint: disable=redefined-outer-name
160+
def test_notebook_document__did_change(client_server_pair): # pylint: disable=redefined-outer-name
161161
client, server = client_server_pair
162162
client._endpoint.request(
163163
"initialize",
@@ -258,7 +258,7 @@ def test_notebook_document__did_change(client_server_pair): # pylint: disable=re
258258
)
259259
wait_for_condition(lambda: mock_notify.call_count >= 1)
260260
assert len(server.workspace.documents) == 2
261-
assert not "cell_2_uri" in server.workspace.documents
261+
assert "cell_2_uri" not in server.workspace.documents
262262
assert len(server.workspace.get_document("notebook_uri").cells) == 1
263263
expected_call_args = [
264264
call(
@@ -406,7 +406,7 @@ def test_notebook_document__did_change(client_server_pair): # pylint: disable=re
406406
mock_notify.assert_has_calls(expected_call_args)
407407

408408

409-
def test_notebook__did_close(client_server_pair): # pylint: disable=redefined-outer-name
409+
def test_notebook__did_close(client_server_pair): # pylint: disable=redefined-outer-name
410410
client, server = client_server_pair
411411
client._endpoint.request(
412412
"initialize",

0 commit comments

Comments
 (0)