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

Update for new NotebookCellOutput changes #35

Merged
merged 3 commits into from
Mar 17, 2021

Conversation

IanMatthewHuff
Copy link
Member

Update per changes here:
microsoft/vscode#117444

@IanMatthewHuff
Copy link
Member Author

Note I have more testing to do here. But wanted to put this up earlier rather than later since I've not worked in this area much. Would rather get feedback if I'm barking up any wrong trees earlier.

Main testing is to update the downloaded renderer bits alongside VS Code stable to make sure that the old API path still works. Also there needs to be update changes in the ipywidget code in the jupyter extension. Will file separate issue and handle that separate.

data: {
[request.mime]: request.value
},
metadata: request.metadata || {},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metadata is the bit that I want to check in particular when I look at the old API with stable. The new layout is a bit odd. There is a top-level metadata and then another unlabeled metadata just below that. I think it's the old custom metadata as it has needs_background in it.

image

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly the naming seems odd. metadata.metadata feels vague to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we give VS Code that feedback?

@IanMatthewHuff IanMatthewHuff marked this pull request as ready for review March 16, 2021 18:33
@IanMatthewHuff
Copy link
Member Author

Testing done:

  1. Debugging Jupyter + Python + Renderers with code-insiders. Open clear outputs and run manualTestFile.ipynb. All output looks good.
  2. Copy output of vscode-notebook-renderers/out/client_renderer into the client_renderer folder of the jupyter extension that I have installed into VSCode stable. Cleared and ran manualTestFile.ipynb. Output all looked good. I know that it was using my updated code as the console.errors were now console.logs.

@DonJayamanne Any other particular areas of testing that I should do to verify this?

try {
console.error('request', request);
console.log('request', request);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why these were errors, so I converted them.

if (outputMetadata && outputMetadata[request.mimeType] && outputMetadata[request.mimeType].metadata) {
const metadata: Record<string, any> = {};

const oldRequest = (request as unknown) as OldNotebookOutputEventParams;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is casting to unknown better practice?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was what I was reading. (Full confession, I didn't actually know this beforehand, and looked it up after a hint from a TS compiler warning). Here is Anders commenting on the addition of unknown. Basically a typesafe any so that you can use it safely as an intermediate with casting.
microsoft/TypeScript#24439

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL, thanks :)

data: {
[request.mime]: request.value
},
metadata: request.metadata || {},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we give VS Code that feedback?

@IanMatthewHuff
Copy link
Member Author

I think the build is working, but it seems disconnected from the status page here. Will investigate:
image

@DonJayamanne
Copy link
Contributor

@IanMatthewHuff you might want to update the code in Jpuyter extension, we have some code related to ipywidgets as well. src/datascience-ui/ipywidgets/renderer/index.ts

@IanMatthewHuff
Copy link
Member Author

Squashing as tests are passing on AzDO

@IanMatthewHuff IanMatthewHuff merged commit 07b860d into main Mar 17, 2021
@IanMatthewHuff IanMatthewHuff deleted the dev/ianhu/updateRenderers branch March 17, 2021 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants