Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to map a NotebookCellData to NotebookCell #97839

Closed
DonJayamanne opened this issue May 14, 2020 · 4 comments
Closed

Add ability to map a NotebookCellData to NotebookCell #97839

DonJayamanne opened this issue May 14, 2020 · 4 comments
Assignees
Labels
Milestone

Comments

@DonJayamanne
Copy link
Contributor

  • Assume we have Cells a, b, c in an ipynb file (raw notebook).
    • Each of the cells have their own metadata
  • Extension returns instances of NotebookCellData to VS Code from NotebookContentProvider:
    • A, B, C
    • The objects returned are NotebookCellData
  • Later VSC creates its own representation and uses NotebookCell (for other API, execution, edits, etc).
    • Assume user Copies cell A and add its below A or above A
    • Assume user moves cell A below B

As NotebookCell is not a subclass of NotebookCellData (there's no link between the two), its impossible for extensions to identify which is which.

Why do we need this:

  • Running cell B, could result in updates to Cell A
    • At this point we need a way to uniquely identify Cell A from the NotebookCells.
    • Using metadata to identify a cell will not work as copying/pasting cells also copies the metadata

Possible solutions

  • Expose finer grained events when cells are modified
    • User adds a new cell, notify extension about this (at this point we can update the metadata as we see fit, to ensure we do not get confused between the two cells).

@rebornix I believe adding finer grained events is a WIP, hence please feel free to close this issue.

@vscodebot
Copy link

vscodebot bot commented May 14, 2020

@rebornix
Copy link
Member

When copy and paste cells, I think we should only copy language/content, metadata will not be copied and cell Uri will be a new one, this will solve your problem, right? @DonJayamanne

@rebornix rebornix added the info-needed Issue requires more information from poster label May 15, 2020
@DonJayamanne
Copy link
Contributor Author

this will solve your problem, right? @DonJayamanne

Yes it will. Awesome thanks.

@rebornix
Copy link
Member

Just pushed a test to ensure when copy cells, the custom metadata are not copied.

@rebornix rebornix added this to the May 2020 milestone May 18, 2020
@rebornix rebornix removed the info-needed Issue requires more information from poster label May 18, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jul 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants