Path: blob/main/src/vs/base/browser/ui/findinput/findInputToggles.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { getDefaultHoverDelegate } from '../hover/hoverDelegateFactory.js';6import { IHoverDelegate } from '../hover/hoverDelegate.js';7import { Toggle } from '../toggle/toggle.js';8import { Codicon } from '../../../common/codicons.js';9import * as nls from '../../../../nls.js';1011export interface IFindInputToggleOpts {12readonly appendTitle: string;13readonly isChecked: boolean;14readonly inputActiveOptionBorder: string | undefined;15readonly inputActiveOptionForeground: string | undefined;16readonly inputActiveOptionBackground: string | undefined;17readonly hoverDelegate?: IHoverDelegate;18}1920const NLS_CASE_SENSITIVE_TOGGLE_LABEL = nls.localize('caseDescription', "Match Case");21const NLS_WHOLE_WORD_TOGGLE_LABEL = nls.localize('wordsDescription', "Match Whole Word");22const NLS_REGEX_TOGGLE_LABEL = nls.localize('regexDescription', "Use Regular Expression");2324export class CaseSensitiveToggle extends Toggle {25constructor(opts: IFindInputToggleOpts) {26super({27icon: Codicon.caseSensitive,28title: NLS_CASE_SENSITIVE_TOGGLE_LABEL + opts.appendTitle,29isChecked: opts.isChecked,30hoverDelegate: opts.hoverDelegate ?? getDefaultHoverDelegate('element'),31inputActiveOptionBorder: opts.inputActiveOptionBorder,32inputActiveOptionForeground: opts.inputActiveOptionForeground,33inputActiveOptionBackground: opts.inputActiveOptionBackground34});35}36}3738export class WholeWordsToggle extends Toggle {39constructor(opts: IFindInputToggleOpts) {40super({41icon: Codicon.wholeWord,42title: NLS_WHOLE_WORD_TOGGLE_LABEL + opts.appendTitle,43isChecked: opts.isChecked,44hoverDelegate: opts.hoverDelegate ?? getDefaultHoverDelegate('element'),45inputActiveOptionBorder: opts.inputActiveOptionBorder,46inputActiveOptionForeground: opts.inputActiveOptionForeground,47inputActiveOptionBackground: opts.inputActiveOptionBackground48});49}50}5152export class RegexToggle extends Toggle {53constructor(opts: IFindInputToggleOpts) {54super({55icon: Codicon.regex,56title: NLS_REGEX_TOGGLE_LABEL + opts.appendTitle,57isChecked: opts.isChecked,58hoverDelegate: opts.hoverDelegate ?? getDefaultHoverDelegate('element'),59inputActiveOptionBorder: opts.inputActiveOptionBorder,60inputActiveOptionForeground: opts.inputActiveOptionForeground,61inputActiveOptionBackground: opts.inputActiveOptionBackground62});63}64}656667