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

Notebook kernel source menu contribution #150146

Merged
merged 14 commits into from
May 24, 2022
Prev Previous commit
Next Next commit
remove remaining kernel state.
  • Loading branch information
rebornix committed May 23, 2022
commit 17f17b429b44b55e158913159fc06279921a23e4
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import 'vs/css!./notebookKernelActionViewItem';
import { ActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
import { Action, IAction } from 'vs/base/common/actions';
import { DisposableStore } from 'vs/base/common/lifecycle';
import { localize } from 'vs/nls';
import { ThemeIcon } from 'vs/platform/theme/common/themeService';
import { executingStateIcon, selectKernelIcon } from 'vs/workbench/contrib/notebook/browser/notebookIcons';
Expand All @@ -18,7 +17,6 @@ import { INotebookEditor } from 'vs/workbench/contrib/notebook/browser/notebookB
export class NotebooKernelActionViewItem extends ActionViewItem {

private _kernelLabel?: HTMLAnchorElement;
private _kernelDisposable: DisposableStore;

constructor(
actualAction: IAction,
Expand All @@ -34,7 +32,6 @@ export class NotebooKernelActionViewItem extends ActionViewItem {
this._register(_notebookKernelService.onDidChangeNotebookAffinity(this._update, this));
this._register(_notebookKernelService.onDidChangeSelectedNotebooks(this._update, this));
this._register(_notebookKernelService.onDidChangeSourceActions(this._update, this));
this._kernelDisposable = this._register(new DisposableStore());
}

override render(container: HTMLElement): void {
Expand Down Expand Up @@ -96,7 +93,6 @@ export class NotebooKernelActionViewItem extends ActionViewItem {
}

private _updateActionFromKernelInfo(info: INotebookKernelMatchResult): void {
this._kernelDisposable.clear();
this._action.enabled = true;
this._action.class = ThemeIcon.asClassName(selectKernelIcon);
const selectedOrSuggested = info.selected ?? (info.suggestions.length === 1 ? info.suggestions[0] : undefined);
Expand All @@ -107,12 +103,6 @@ export class NotebooKernelActionViewItem extends ActionViewItem {
if (!info.selected) {
// special UI for selected kernel?
}

this._kernelDisposable.add(selectedOrSuggested.onDidChange(e => {
if (e.state) {
this._action.label = this._generateKenrelLabel(selectedOrSuggested);
}
}));
} else {
// many kernels or no kernels
this._action.label = localize('select', "Select Kernel");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const apiMenus: IAPIMenu[] = [
key: 'notebook/kernelSource',
id: MenuId.NotebookKernelSource,
description: localize('notebook.kernelSource', "The contributed notebook kernel sources menu"),
proposed: 'notebookProxyController'
proposed: 'notebookKernelSource'
},
{
key: 'notebook/cell/title',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ export const allApiProposals = Object.freeze({
notebookEditor: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookEditor.d.ts',
notebookEditorDecorationType: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookEditorDecorationType.d.ts',
notebookEditorEdit: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookEditorEdit.d.ts',
notebookKernelSource: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookKernelSource.d.ts',
notebookLiveShare: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookLiveShare.d.ts',
notebookMessaging: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMessaging.d.ts',
notebookMime: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookMime.d.ts',
notebookProxyController: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookProxyController.d.ts',
notebookWorkspaceEdit: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.notebookWorkspaceEdit.d.ts',
portsAttributes: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.portsAttributes.d.ts',
quickPickSortByLabel: 'https://raw.githubusercontent.com/microsoft/vscode/main/src/vscode-dts/vscode.proposed.quickPickSortByLabel.d.ts',
Expand Down