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 Jupyter to new notebook preload message api #5775

Merged
merged 10 commits into from
May 6, 2021

Conversation

IanMatthewHuff
Copy link
Member

For #5753

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR).
  • Title summarizes what is changing.
  • Has a news entry file (remember to thank yourself!).
  • Appropriate comments and documentation strings in the code.
  • Has sufficient logging.
  • Has telemetry for enhancements.
  • Unit tests & system/integration tests are added/updated.
  • Test plan is updated as appropriate.
  • package-lock.json has been regenerated by running npm install (if dependencies have changed).

@IanMatthewHuff IanMatthewHuff requested a review from a team as a code owner May 5, 2021 21:29
)
}
]
new NotebookKernelPreload(Uri.file(
Copy link
Member Author

Choose a reason for hiding this comment

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

Minor change from new proposed. Needed to use the new class here.

@@ -30,4 +29,4 @@ function initialize(api: NotebookRendererApi<any>) {
api.onWillDestroyOutput(disposeOutput);
}

initialize(acquireNotebookRendererApi(JupyterIPyWidgetNotebookRenderer));
initialize(acquireNotebookRendererApi());
Copy link
Member Author

Choose a reason for hiding this comment

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

Another change from proposed, correct name is automatically passed.

@@ -74,38 +84,70 @@ export class PostOffice implements IDisposable {
}

public acquireApi(): IVsCodeApi | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this could be split up more? Or generalized into two different functions instead of multiple if points? I know some of it might be duped in each function, but I believe there's two distinct paths here?

  • postKerneMessage = native case
  • acquireVsCodeApi = webview case

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm suggesting:

  • acquireApi (highest level)
  • acquireNativeApi (for native case when new function - isNative - returns true). This function would do the work for bnding for the native case.
  • acquireWebViewApi - This function would do the code we used to have?

Copy link
Member Author

Choose a reason for hiding this comment

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

Were you thinking like just break this function up into the kernel / vs code specific functions? Or more like factor our a full common interface. Full interface feels kinda heavy, but it might read better.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think two different functions would be good enough and make it clearer which path you were on.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was actually starting down the path of an interface / class refactor. What do you think about this? @rchiodo

Copy link
Contributor

@joyceerhl joyceerhl left a comment

Choose a reason for hiding this comment

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

Apologies if you already did this, but I believe you may need to update to npm7 to generate a v2 package-lock if you haven't already done so.

@codecov-commenter
Copy link

codecov-commenter commented May 5, 2021

Codecov Report

Merging #5775 (dff3b08) into main (03597f5) will increase coverage by 6%.
The diff coverage is n/a.

❗ Current head dff3b08 differs from pull request most recent head 373b791. Consider uploading reports for the commit 373b791 to get more accurate results

@@           Coverage Diff           @@
##            main   #5775     +/-   ##
=======================================
+ Coverage     65%     72%     +6%     
=======================================
  Files        352     403     +51     
  Lines      24148   26916   +2768     
  Branches    3637    3926    +289     
=======================================
+ Hits       15818   19454   +3636     
+ Misses      6939    5820   -1119     
- Partials    1391    1642    +251     
Impacted Files Coverage Δ
...t/datascience/notebook/vscodeNotebookController.ts 77% <ø> (ø)
src/client/api.ts 64% <0%> (ø)
...ent/datascience/interactive-common/linkProvider.ts 34% <0%> (ø)
src/client/telemetry/extensionInstallTelemetry.ts 75% <0%> (ø)
...ient/datascience/jupyter/kernels/kernelProvider.ts 96% <0%> (ø)
src/client/telemetry/languageInitializer.ts 100% <0%> (ø)
src/client/logging/serviceRegistry.ts 100% <0%> (ø)
src/client/extensionInit.ts 100% <0%> (ø)
src/client/activation/serviceRegistry.ts 100% <0%> (ø)
...ascience/notebook/notebookEditorProviderWrapper.ts 63% <0%> (ø)
... and 163 more

@IanMatthewHuff
Copy link
Member Author

Apologies if you already did this, but I believe you may need to update to npm7 to generate a v2 package-lock if you haven't already done so.

Thanks, updated to latest 7 version and regenerated.

@IanMatthewHuff IanMatthewHuff merged commit ebf0c2e into main May 6, 2021
@IanMatthewHuff IanMatthewHuff deleted the dev/ianhu/updateMessageAPI branch May 6, 2021 00:15
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.

6 participants