-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Deserialize function doesn't have uri parameter #125757
Comments
Looks like a product question so moving to the vscode product repo. |
Thanks @gregvanl, it was in the wrong repo. |
This comment has been minimized.
This comment has been minimized.
Hey @jrieken, can we reopen the conversation about migrating Live Share to serializers? We have a new suggestion for what we need to move away from content providers. Can we get an API to get a reference to a serializer and call deserializeNotebook on it? Then, we could keep a 1:1 mapping of serializers from the host to the guest. We can include the notebook type in our RPC request and then from the notebook type, get the reference to the serializer and call it. Would this work? |
Things needed to onboard LS onto serializers
Rough sketch of the flow
|
…Notebook` to execute notebook serializers by type, #125757
I have pushed changes to make sure the I have also pushed to new commands that allow to "execute" a notebook serializer: vscode/extensions/vscode-api-tests/src/singlefolder-tests/notebook.test.ts Lines 1026 to 1041 in d58ff26
|
These changes should allow LiveShare to migrate onto the notebook serializer API. Please let me know how that goes |
@jrieken things are working with the serializers for most files. I have one test file that this command does not work with and I get the following error: To repro, I set up a serializer that deserializes the content of the file with this command using the jupyter serializer. extension.ts
With this extension activated, open this file: nb.ipynb
Two other issues I'm working on to remove content providers:
cc @daytonellwanger for visibility on these two issues. |
Not sure what excluded means in this in this context?
Would the |
For the excluded scenario, the host can have a list of files that they do not want to show to guests. When the guest requests an open, we check the list of excluded files and do not return the notebook data if the requested notebook is marked as excluded. For the cell managers, I think we can use the Do you have any updates about the cause of the error I mentioned? |
Please file a new, dedicated issue for that.
Wouldn't it make more sense to do the check in the layer that implements the file system? E.g I assume the guest has a virtual file system which is implemented by the host. To me that looks like a better place for such checks, otherwise the guest can always workaround those protections, e.g have an extension snippet doing the equivalent of |
New issue here: #147711 (comment). |
I'm not sure if here is the right place to continue this conversation (perhaps #147248 would be better?). You're correct about the exclusion issue. We can block excluded files from being read (and then handed to the serializer) in our file system. However, the cell ids remain an issue, and I'm not sure that we can switch to serializers with the current APIs. We depend on the NotebookDocument returned from the host to have associated cell ids that we use for all coediting functionality. Unfortunately with serializers, the host is returning the notebook contents that come from on disk, which does not include unsaved changes (like our cell ids). We have a few ideas to work around this, but they are a complicated and not ideal. I can schedule this work for after Build, but it will take some time to figure out the right way to rework this. In the meantime to move us away from content providers, could we add an option to I can explain the cell id situation in greater detail if that would be helpful. |
Yeah, that would be great because I believe I am missing the bigger picture. Adding the uri-parameter to these calls might be possible but there is no guarantee that we always have this information. Internally this is just a context-free transform operation from bytes to structured data (similar to how text encoding/decoding works) and that can occur without a file/uri at hands. I also want to make sure that we are on the same page wrt lifecycle: Serializing and deserializing a notebook can occur multiple times "per notebook", e.g we deserialize for the initial open but it can happen again without the notebook having been closed/opened. In short: taking the deserialize call as signal to install something is likely wrong and error prone. The open/close events should be used instead. I also want to learn about the cell ids and how it drives coediting, I thought LS build upon the fact that every notebook cell is also a text document. |
I am working on getting Live Share notebooks functional again after recent API changes. We want Live Share notebooks to be running on stable APIs, which means using serializers rather than content providers.
However, serializers do not work for the guest scenario. Previously, the guest's content provider would have an openNotebook function with a uri parameter for the document being opened. We proxied that request to the host, where we could use
vscode.notebook.openNotebookDocument
with the uri. Now, deserialize only includes the document's content. I can add the serializer's view type to proxied request, but the only information we can give the host is content and viewtype. We need it to return NotebookData, but we cannot identify which notebook document to deserialize.Could
vscode.commands.executeCommand('_resolveNotebookContentProvider');
return serializers that have callable deserialize functions?cc @jrieken @rebornix @Davsterl
The text was updated successfully, but these errors were encountered: