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

Upgrade to new lsp middleware concat #8219

Merged
merged 6 commits into from
Nov 10, 2021
Merged

Upgrade to new lsp middleware concat #8219

merged 6 commits into from
Nov 10, 2021

Conversation

rchiodo
Copy link
Contributor

@rchiodo rchiodo commented Nov 10, 2021

For #8075

Need to do more testing to make sure this all works. Found a problem where the notebook controller wasn't being indicated on reopen of a notebook.

Also had to wire up the 'refresh' for the concat document (when a notebook cells move around)

@rchiodo rchiodo requested a review from a team as a code owner November 10, 2021 00:26
// Stick in our list of associated documents and indicate controller may have changed.
if (!this.associatedDocuments.has(notebook)) {
this.associatedDocuments.add(notebook);
this._onNotebookControllerSelected.fire({ notebook, controller: this });
Copy link
Contributor

Choose a reason for hiding this comment

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

Setting affinity is not the same as setting it as selected.
You could have a notebook that's associated with kernel A, but the recommended kernel (affinity) is Kernel B.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd consider raising a seprate event and or having a seprate method to get the recommended kernel.
I believe you need this for instances where a kernel isn't seleced, but want to provide the right intellisense, if that's the case a seprate property/event would be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No this is exactly what I want.

This is what is happening now.

  • User opens a notebook, kernel is associated with document, notebook selection change event fires
  • User closes notebook
  • User reopens notebook. Nothing fires, controller doesn't even know what the selection is.

I think what should happen is the same thing as the first one

  • User opens a notebook, kernel is associated with document, notebook selection change event fires

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I need this so that on second open, the intellisense is using the correct (selected) kernel.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On first open, the reason it works is because the selection change event fires after setting affinity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This code here:

this.associatedDocuments.add(event.notebook);

Which is triggered by this:

this.controller.onDidChangeSelectedNotebooks(this.onDidChangeSelectedNotebooks, this, this.disposables);

On a second open that selection changed event doesn't fire.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok got it, but if you create a brand new notebook, then this event will still get fired even when no kernel is selected.
Today there's a bug in VS Code causing kernels to get auto selecfed, hence this will work.

I'll merge my fix tomorrow into VS Code and then we can re-visit this PR.
I still don't think this is right.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay trying a different way. We can just remember it like VS code does. When it gets set, stick it in a map.

// Stick in our list of associated documents and indicate controller may have changed.
if (!this.associatedDocuments.has(notebook)) {
this.associatedDocuments.add(notebook);
this._onNotebookControllerSelected.fire({ notebook, controller: this });
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd consider raising a seprate event and or having a seprate method to get the recommended kernel.
I believe you need this for instances where a kernel isn't seleced, but want to provide the right intellisense, if that's the case a seprate property/event would be better.

@codecov-commenter
Copy link

codecov-commenter commented Nov 10, 2021

Codecov Report

Merging #8219 (b7c8bf1) into main (ef0e3eb) will decrease coverage by 13%.
The diff coverage is 87%.

❗ Current head b7c8bf1 differs from pull request most recent head 827c1d7. Consider uploading reports for the commit 827c1d7 to get more accurate results

@@           Coverage Diff           @@
##            main   #8219     +/-   ##
=======================================
- Coverage     71%     58%    -14%     
=======================================
  Files        365     368      +3     
  Lines      22573   22589     +16     
  Branches    3413    3419      +6     
=======================================
- Hits       16182   13184   -2998     
- Misses      4997    8240   +3243     
+ Partials    1394    1165    -229     
Impacted Files Coverage Δ
...t/datascience/notebook/vscodeNotebookController.ts 51% <75%> (-26%) ⬇️
...atascience/notebook/intellisense/languageServer.ts 66% <100%> (-4%) ⬇️
src/client/datascience/kernelSocketWrapper.ts 3% <0%> (-84%) ⬇️
src/client/debugger/jupyter/kernelDebugAdapter.ts 5% <0%> (-77%) ⬇️
src/client/common/net/socket/SocketStream.ts 4% <0%> (-73%) ⬇️
src/client/datascience/export/exportUtil.ts 19% <0%> (-70%) ⬇️
src/client/common/refBool.ts 33% <0%> (-67%) ⬇️
...lient/debugger/extension/helpers/protocolParser.ts 15% <0%> (-65%) ⬇️
...c/client/datascience/export/exportToPythonPlain.ts 23% <0%> (-65%) ⬇️
src/client/datascience/export/fileConverter.ts 27% <0%> (-63%) ⬇️
... and 201 more

@rchiodo rchiodo merged commit ff8acb2 into main Nov 10, 2021
@rchiodo rchiodo deleted the rchiodo/custom_concat branch November 10, 2021 16:41
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.

3 participants