Skip to content

Add notebook document sync infrastructure for Jupyter support#664

Draft
edvilme wants to merge 3 commits intomainfrom
notebook-support-infra
Draft

Add notebook document sync infrastructure for Jupyter support#664
edvilme wants to merge 3 commits intomainfrom
notebook-support-infra

Conversation

@edvilme
Copy link
Contributor

@edvilme edvilme commented Mar 10, 2026

Summary

Adds Jupyter notebook (.ipynb) and Interactive Window support using the LSP 3.17 Notebook Document Sync protocol, following the upstream template PR microsoft/vscode-python-tools-extension-template#265 and the existing �scode-isort implementation.

Changes

  • package.json: Add onNotebook:jupyter-notebook and onNotebook:interactive activation events
  • bundled/tool/lsp_server.py:
    • Add NOTEBOOK_SYNC_OPTIONS constant and wire into LanguageServer constructor
    • Add _get_document_path() helper to resolve vscode-notebook-cell: URIs to filesystem paths
    • Add four notebook lifecycle handlers (didOpen, didChange, didSave, didClose) that publish diagnostics for Python code cells
    • Remove the notebook-cell skip guard

Upstream

Note: _get_document_path() already exists in this repo. Notebook lifecycle handlers are deferred because formatting logic diverges from the linting pattern used in the other extensions.

Ref #87

- Add NOTEBOOK_SYNC_OPTIONS and notebook_document_sync to LanguageServer
- Add onNotebook:jupyter-notebook and onNotebook:interactive activation events
- Notebook lifecycle handlers will be added separately (formatting-specific)

Ref #87

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@edvilme edvilme added feature-request Request for new features or functionality debt Technical debt or repo cleanup labels Mar 10, 2026
@edvilme edvilme marked this pull request as draft March 10, 2026 20:45
edvilme and others added 2 commits March 10, 2026 13:50
Add NOTEBOOK_DOCUMENT_DID_* event constants and notebook-related type
classes (NotebookDocumentSyncOptions, NotebookCellLanguage, etc.) to the
lsprotocol.types mock so lsp_server.py can be imported in unit tests.
Also update _MockLS to use Pygls 2.0 method names.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
NotebookCellLanguage(language='python') and similar calls require
the mock classes to accept **kwargs in __init__.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debt Technical debt or repo cleanup feature-request Request for new features or functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant