-
Notifications
You must be signed in to change notification settings - Fork 307
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
Enable an experimental setting for the new kernel picker UI #10807
Conversation
"description": "%jupyter.configuration.jupyter.showOnlyOneTypeOfKernel.markdownDescription%", | ||
"scope": "machine", | ||
"tags": [ | ||
"experimental" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This tag enables the changing of this setting through an experiment service.
this.showingRemoteNotWebContext.set(!isLocal && !this.isWeb).ignoreErrors(); | ||
this.showingRemoteContext.set(!isLocal && this.controllerRegistration.values.length > 0).ignoreErrors(); | ||
} else { | ||
this.showingLocalOrWebEmptyContext.set(false).ignoreErrors(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commands are always hidden if the setting is turned off
@@ -228,6 +239,13 @@ export class ControllerRegistration implements IControllerRegistration { | |||
this.onDidChangeFilter(); | |||
} | |||
|
|||
private onDidChangeConfiguration(e: ConfigurationChangeEvent) { | |||
if (e.affectsConfiguration('jupyter.showOnlyOneTypeOfKernel')) { | |||
this.inKernelExperiment = this.workspace.getConfiguration('jupyter')?.get('showOnlyOneTypeOfKernel', false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When onDidChangeConfiguration fires, the config service doesn't necessarily have the update yet (it's listening to the same event), so had to use the workspace.getConfiguration call here instead.
@@ -139,3 +144,10 @@ type InterpreterFiter = { | |||
*/ | |||
path: string; | |||
}; | |||
type RemoteSpecFilter = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added support for remote filtering. Made testing this easier.
await selector.selectJupyterURI(); | ||
let value = await storage.getUri(); | ||
assert.equal(value, Settings.JupyterServerLocalLaunch, 'Default should pick local launch'); | ||
suite('Experimental', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two copies of the tests.
One for new way the server selector works
One for the old way.
@@ -183,6 +183,13 @@ export class VSCodeNotebookController implements Disposable, IVSCodeNotebookCont | |||
this.controller.supportedLanguages = this.languageService.getSupportedLanguages(kernelConnection); | |||
// Hook up to see when this NotebookController is selected by the UI | |||
this.controller.onDidChangeSelectedNotebooks(this.onDidChangeSelectedNotebooks, this, this.disposables); | |||
this.notebookApi.onDidCloseNotebookDocument( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Associated documents were surviving tests closing notebooks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which could also potentially happen in the real product.
User opens notebook
Connects to remote
User closes notebook
User opens another notebook
Connects to local
Kernel list still includes remote connection from notebook that isn't open anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New test I added is verifying this isn't the case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might improve performance and potentially fix other unnoticed bugs! I think? This looks really promising to me
|
||
return items; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleanly done! I like it
@@ -65,7 +71,7 @@ export class KernelFilterUI implements IExtensionSyncActivationService, IDisposa | |||
}) | |||
.map((item) => { | |||
return <QuickPickType>{ | |||
label: getDisplayNameOrNameOfKernelConnection(item), | |||
label: getKernelLabel(item), | |||
picked: !this.kernelFilter.isKernelHidden(item), | |||
description: getKernelConnectionPath(item, this.workspace), | |||
detail: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
@@ -183,7 +189,12 @@ export class ControllerRegistration implements IControllerRegistration { | |||
const userFiltered = this.kernelFilter.isKernelHidden(metadata); | |||
const connectionTypeFiltered = isLocalConnection(metadata) !== this.isLocalLaunch; | |||
const urlFiltered = isRemoteConnection(metadata) && this.serverUriStorage.currentServerId !== metadata.serverId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed the additoin of this new function,
Can we change the code in isRemoteConnection
to just call isLocalConnection
and negate the value.
This way we don't have the logic in two functions.
I.e. isRemoteConnection would be the opposite of the return value of isLocalConnection
this would allow us to keep the logic in one place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks ok, except for a problem with the all
& registeredMetadatas
properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Please see my reply to the 'values' and 'all' conversation. Maybe I should rename 'values' to 'filtered'. It is the filtered list, which when you're local it only has local values, but not remote and vice versa. The 'all' property is every kernel connection every registered. |
Codecov Report
@@ Coverage Diff @@
## main #10807 +/- ##
=======================================
Coverage 63% 63%
=======================================
Files 481 481
Lines 33427 33628 +201
Branches 5447 5488 +41
=======================================
+ Hits 21119 21276 +157
- Misses 10267 10311 +44
Partials 2041 2041
|
Or just |
Fixes #10782
For the most part I left a copy of the code for the UI parts. This was simpler than trying to make the new code handle the old UI and the new.