Skip to content

Commit

Permalink
Fix leaks in notebook actions (#241430)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne authored Feb 21, 2025
1 parent 233d086 commit f5f0a61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ export class NotebookChatActionsOverlay extends Disposable {
actionViewItemProvider: (action, options) => {

if (action.id === navigationBearingFakeActionId) {
return new class extends ActionViewItem {
return this._register(new class extends ActionViewItem {
constructor() {
super(undefined, action, { ...options, icon: false, label: false, keybindingNotRenderedWithLabel: true });
}
};
});
}

if (action.id === AcceptAction.ID || action.id === RejectAction.ID) {
return new class extends ActionViewItem {
return this._register(new class extends ActionViewItem {
private readonly _reveal = this._store.add(new MutableDisposable());
constructor() {
super(undefined, action, { ...options, icon: false, label: true, keybindingNotRenderedWithLabel: true });
Expand Down Expand Up @@ -143,23 +143,23 @@ export class NotebookChatActionsOverlay extends Disposable {
override get actionRunner(): IActionRunner {
return super.actionRunner;
}
};
});
}
// Override next/previous with our implementation.
if (action.id === 'chatEditor.action.navigateNext' || action.id === 'chatEditor.action.navigatePrevious') {
return new class extends ActionViewItem {
return this._register(new class extends ActionViewItem {
constructor() {
super(undefined, action, { ...options, icon: true, label: false, keybindingNotRenderedWithLabel: true });
}
override set actionRunner(_: IActionRunner) {
const next = action.id === 'chatEditor.action.navigateNext' ? nextEntry : previousEntry;
const direction = action.id === 'chatEditor.action.navigateNext' ? 'next' : 'previous';
super.actionRunner = new NextPreviousChangeActionRunner(notebookEditor, cellDiffInfo, entry, next, direction, _editorService, deletedCellDecorator, focusedDiff);
super.actionRunner = this._register(new NextPreviousChangeActionRunner(notebookEditor, cellDiffInfo, entry, next, direction, _editorService, deletedCellDecorator, focusedDiff));
}
override get actionRunner(): IActionRunner {
return super.actionRunner;
}
};
});
}
return undefined;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class NotebookEditor extends EditorPane implements INotebookEditorPane, I
override getActionViewItem(action: IAction, options: IActionViewItemOptions): IActionViewItem | undefined {
if (action.id === SELECT_KERNEL_ID) {
// this is being disposed by the consumer
return this._instantiationService.createInstance(NotebooKernelActionViewItem, action, this, options);
return this._register(this._instantiationService.createInstance(NotebooKernelActionViewItem, action, this, options));
}
return undefined;
}
Expand Down

0 comments on commit f5f0a61

Please sign in to comment.