Skip to content

Commit

Permalink
Expose "select matches" in find widget using ThemeIcon
Browse files Browse the repository at this point in the history
We use `expand-all` for the "select matches" icon.
We also rename from "find all" to "select all" for microsoft#128915.
Refs: ec02bcd & microsoft#14836
  • Loading branch information
zm-cttae authored Feb 2, 2023
1 parent 55d4e48 commit 0ba4684
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/vs/editor/contrib/find/browser/findWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ export const findReplaceIcon = registerIcon('find-replace', Codicon.replace, nls
export const findReplaceAllIcon = registerIcon('find-replace-all', Codicon.replaceAll, nls.localize('findReplaceAllIcon', 'Icon for \'Replace All\' in the editor find widget.'));
export const findPreviousMatchIcon = registerIcon('find-previous-match', Codicon.arrowUp, nls.localize('findPreviousMatchIcon', 'Icon for \'Find Previous\' in the editor find widget.'));
export const findNextMatchIcon = registerIcon('find-next-match', Codicon.arrowDown, nls.localize('findNextMatchIcon', 'Icon for \'Find Next\' in the editor find widget.'));
export const selectAllMatchesIcon = registerIcon('select-all-matches', Codicon.expandAll, nls.localize('selectAllMatches', 'Icon for \'Select All Matches\' in the editor find widget.'));

export interface IFindController {
selectAllMatches(): void;
replace(): void;
replaceAll(): void;
getGlobalBufferTerm(): Promise<string>;
Expand All @@ -63,6 +65,7 @@ const NLS_FIND_INPUT_LABEL = nls.localize('label.find', "Find");
const NLS_FIND_INPUT_PLACEHOLDER = nls.localize('placeholder.find', "Find");
const NLS_PREVIOUS_MATCH_BTN_LABEL = nls.localize('label.previousMatchButton', "Previous Match");
const NLS_NEXT_MATCH_BTN_LABEL = nls.localize('label.nextMatchButton', "Next Match");
const NLS_SELECT_ALL_MATCHES_BTN_LABEL = nls.localize('label.selectAllMatchesButton', "Select All Matches");
const NLS_TOGGLE_SELECTION_FIND_TITLE = nls.localize('label.toggleSelectionFind', "Find in Selection");
const NLS_CLOSE_BTN_LABEL = nls.localize('label.closeButton', "Close");
const NLS_REPLACE_INPUT_LABEL = nls.localize('label.replace', "Replace");
Expand Down Expand Up @@ -141,6 +144,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
private _closeBtn!: SimpleButton;
private _replaceBtn!: SimpleButton;
private _replaceAllBtn!: SimpleButton;
private _selectAllBtn!: SimpleButton;

private _isVisible: boolean;
private _isReplaceVisible: boolean;
Expand Down Expand Up @@ -1027,6 +1031,15 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
}
}));

// Select all button
this._selectAllBtn = this._register(new SimpleButton({
label: NLS_SELECT_ALL_MATCHES_BTN_LABEL + this._keybindingLabelFor(FIND_IDS.SelectAllMatchesAction),
icon: selectAllMatchesIcon,
onTrigger: () => {
this._controller.selectAllMatches();
}
}));

const findPart = document.createElement('div');
findPart.className = 'find-part';
findPart.appendChild(this._findInput.domNode);
Expand All @@ -1036,6 +1049,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
actionsContainer.appendChild(this._matchesCount);
actionsContainer.appendChild(this._prevBtn.domNode);
actionsContainer.appendChild(this._nextBtn.domNode);
actionsContainer.appendChild(this._selectAllBtn.domNode);

// Toggle selection button
this._toggleSelectionFind = this._register(new Toggle({
Expand Down

0 comments on commit 0ba4684

Please sign in to comment.