Skip to content

Commit 27f650e

Browse files
authored
Merge pull request microsoft#225650 from microsoft/don/toggleNbDiffToolbarIcons
Support toggled state for icons in nb toolbar
2 parents 9b29e85 + 0b827b2 commit 27f650e

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

src/vs/workbench/contrib/notebook/browser/diff/diffComponents.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,7 @@ export class ModifiedElement extends AbstractElementRenderer {
16661666
this._cellHeader.buildHeader();
16671667
renderSourceEditor();
16681668

1669-
const scopedContextKeyService = this.contextKeyService.createScoped(this._cellHeaderContainer);
1669+
const scopedContextKeyService = this.contextKeyService.createScoped(this.templateData.inputToolbarContainer);
16701670
this._register(scopedContextKeyService);
16711671
const inputChanged = NOTEBOOK_DIFF_CELL_INPUT.bindTo(scopedContextKeyService);
16721672
inputChanged.set(this.cell.modified.textModel.getValue() !== this.cell.original.textModel.getValue());
@@ -1681,21 +1681,16 @@ export class ModifiedElement extends AbstractElementRenderer {
16811681
cell: this.cell
16821682
};
16831683

1684-
const actions: IAction[] = [];
1685-
16861684
const refreshToolbar = () => {
16871685
const ignore = this.textConfigurationService.getValue<boolean>(this.cell.modified.uri, 'diffEditor.ignoreTrimWhitespace');
16881686
ignoreWhitespace.set(ignore);
1689-
16901687
const hasChanges = this.cell.modified.textModel.getValue() !== this.cell.original.textModel.getValue();
16911688
inputChanged.set(hasChanges);
16921689

1693-
if (!actions.length) {
1690+
if (hasChanges) {
1691+
const actions: IAction[] = [];
16941692
const menu = this.menuService.getMenuActions(MenuId.NotebookDiffCellInputTitle, scopedContextKeyService, { shouldForwardArgs: true });
16951693
createAndFillInActionBarActions(menu, actions);
1696-
}
1697-
1698-
if (hasChanges) {
16991694
this._toolbar.setActions(actions);
17001695
} else {
17011696
this._toolbar.setActions([]);

src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ export class CellDiffSideBySideRenderer implements IListRenderer<SideBySideDiffE
248248
}
249249

250250
return undefined;
251-
}
251+
},
252+
highlightToggledItems: true
252253
});
253254

254255
const metadataHeaderContainer = DOM.append(diffEditorContainer, DOM.$('.metadata-header-container'));

0 commit comments

Comments
 (0)