Skip to content

Commit

Permalink
Merge pull request microsoft#225650 from microsoft/don/toggleNbDiffTo…
Browse files Browse the repository at this point in the history
…olbarIcons

Support toggled state for icons in nb toolbar
  • Loading branch information
DonJayamanne authored Aug 15, 2024
2 parents 9b29e85 + 0b827b2 commit 27f650e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
11 changes: 3 additions & 8 deletions src/vs/workbench/contrib/notebook/browser/diff/diffComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ export class ModifiedElement extends AbstractElementRenderer {
this._cellHeader.buildHeader();
renderSourceEditor();

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

const actions: IAction[] = [];

const refreshToolbar = () => {
const ignore = this.textConfigurationService.getValue<boolean>(this.cell.modified.uri, 'diffEditor.ignoreTrimWhitespace');
ignoreWhitespace.set(ignore);

const hasChanges = this.cell.modified.textModel.getValue() !== this.cell.original.textModel.getValue();
inputChanged.set(hasChanges);

if (!actions.length) {
if (hasChanges) {
const actions: IAction[] = [];
const menu = this.menuService.getMenuActions(MenuId.NotebookDiffCellInputTitle, scopedContextKeyService, { shouldForwardArgs: true });
createAndFillInActionBarActions(menu, actions);
}

if (hasChanges) {
this._toolbar.setActions(actions);
} else {
this._toolbar.setActions([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ export class CellDiffSideBySideRenderer implements IListRenderer<SideBySideDiffE
}

return undefined;
}
},
highlightToggledItems: true
});

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

0 comments on commit 27f650e

Please sign in to comment.