|
16 | 16 |
|
17 | 17 | from . import lsp, _utils, uris
|
18 | 18 | from .config import config
|
19 |
| -from .workspace import Workspace, Document, Cell, Notebook |
| 19 | +from .workspace import Workspace, Document, Notebook |
20 | 20 | from ._version import __version__
|
21 | 21 |
|
22 | 22 | log = logging.getLogger(__name__)
|
@@ -469,15 +469,13 @@ def m_completion_item__resolve(self, **completionItem):
|
469 | 469 | return self.completion_item_resolve(completionItem)
|
470 | 470 |
|
471 | 471 | # 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): |
473 | 473 | workspace = self._match_uri_to_workspace(notebookDocument['uri'])
|
474 | 474 | workspace.put_notebook_document(notebookDocument['uri'], notebookDocument['notebookType'],
|
475 | 475 | cells=notebookDocument['cells'], version=notebookDocument.get('version'),
|
476 | 476 | 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')) |
481 | 479 | self.lint(notebookDocument['uri'], is_saved=True)
|
482 | 480 |
|
483 | 481 | 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, **
|
514 | 512 | opened_cells = structure['didOpen']
|
515 | 513 | for cell_document in opened_cells:
|
516 | 514 | 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')) |
519 | 516 | # Cell metadata which is added to Notebook
|
520 | 517 | opened_cells = notebook_cell_array_change['cells']
|
521 | 518 | workspace.add_notebook_cells(notebookDocument['uri'], opened_cells, start)
|
|
0 commit comments