8000 fix pytest test_notebook_document.py · tkrabel-db/python-lsp-server@3dcaf9f · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 3dcaf9f

Browse files
committed
fix pytest test_notebook_document.py
1 parent c891cf0 commit 3dcaf9f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

pylsp/python_lsp.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
from . import lsp, _utils, uris
1818
from .config import config
19-
from .workspace import Workspace, Document, Cell, Notebook
19+
from .workspace import Workspace, Document, Notebook
2020
from ._version import __version__
2121

2222
log = logging.getLogger(__name__)
@@ -469,15 +469,13 @@ def m_completion_item__resolve(self, **completionItem):
469469
return self.completion_item_resolve(completionItem)
470470

471471
# TODO: add m_notebook_document__did_close
472-
def m_notebook_document__did_open(self, notebookDocument=None, cellTextDocuments=[], **_kwargs):
472+
def m_notebook_document__did_open(self, notebookDocument=None, cellTextDocuments=None, **_kwargs):
473473
workspace = self._match_uri_to_workspace(notebookDocument['uri'])
474474
workspace.put_notebook_document(notebookDocument['uri'], notebookDocument['notebookType'],
475475
cells=notebookDocument['cells'], version=notebookDocument.get('version'),
476476
metadata=notebookDocument.get('metadata'))
477-
for cell in cellTextDocuments:
478-
workspace.put_cell_document(cell['uri'], cell['languageId'], notebookDocument['uri'], cell['text'],
479-
version=cell.get('version'))
480-
# self._hook('pylsp_document_did_open', textDocument['uri']) # This hook seems only relevant for rope
477+
for cell in (cellTextDocuments or []):
478+
workspace.put_cell_document(cell['uri'], cell['languageId'], cell['text'], version=cell.get('version'))
481479
self.lint(notebookDocument['uri'], is_saved=True)
482480

483481
def m_notebook_document__did_change(self, notebookDocument=None, change=None, **_kwargs):
@@ -514,8 +512,7 @@ def m_notebook_document__did_change(self, notebookDocument=None, change=None, **
514512
opened_cells = structure['didOpen']
515513
for cell_document in opened_cells:
516514
workspace.put_cell_document(cell_document['uri'], cell_document['languageId'],
517-
notebookDocument['uri'], cell_document['text'],
518-
cell_document.get('version'))
515+
cell_document['text'], cell_document.get('version'))
519516
# Cell metadata which is added to Notebook
520517
opened_cells = notebook_cell_array_change['cells']
521518
workspace.add_notebook_cells(notebookDocument['uri'], opened_cells, start)

0 commit comments

Comments
 (0)
0