You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is my understanding that extension authors need not worry about how many editors are opened for the same document.
Thats great
User starts executing all cells in NotebookA
Now user saves one of them as NotebookB.
At this point one of the Notebook is NotebookA and other is NotebookB & both are opened.
Questions
When invoking saveNotebookAs, will VS Code provide a completely new instance of NotebookDocument with Uri pointing to the new target resource?
I think it should.
Else updates to this NotebookDocument could impact both NotebookA and NotebookB
However creating a copy of NotebookDocument & passing this into saveNotebookAs might not always work
If user has just one notebook opened, then creating a copy will not work as output will not go into this same document (with different file name) while cells are being executed.
Feels like we should create copies only when there's one copy of the editor opened for a notebook document.
Other approaches,
Extension can disable stop execution when user performs a saveas.
However, we end up with similar situation as earlier.
We shouldn't stop execution if there is only one editor for NotebookA opened.
VS Code can disable save as while execution is in progress (don't think this is a good idea - not allowing user to save a file is just wrong)
@rebornix
I'm closing this issue. Considering the fact that this will line up with Custom Editor and looking at existing behavior in Notebooks, I think we can handle this at our end (I'll file a separate issue for some other stuff).
From what I can tell the following happens:
User hits Save as
VS Code will close previous editor and open a new editor for the new target
This works for us, except we need to know whether editors associated with old file are still opened. Separate issue
Assume we have the following scenario:
Questions
saveNotebookAs
, will VS Code provide a completely new instance of NotebookDocument with Uri pointing to the new target resource?NotebookDocument
& passing this intosaveNotebookAs
might not always work@rebornix /cc
& thanks for the awesome work done by the VS Code team for adding this API.
The text was updated successfully, but these errors were encountered: