Path: blob/main/src/vs/base/browser/ui/findinput/findInputToggles.ts
5241 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 { Toggle } from '../toggle/toggle.js';6import { Codicon } from '../../../common/codicons.js';7import * as nls from '../../../../nls.js';8import { type IHoverLifecycleOptions } from '../hover/hover.js';910export interface IFindInputToggleOpts {11readonly appendTitle: string;12readonly isChecked: boolean;13readonly inputActiveOptionBorder: string | undefined;14readonly inputActiveOptionForeground: string | undefined;15readonly inputActiveOptionBackground: string | undefined;16readonly hoverLifecycleOptions?: IHoverLifecycleOptions;17}1819const NLS_CASE_SENSITIVE_TOGGLE_LABEL = nls.localize('caseDescription', "Match Case");20const NLS_WHOLE_WORD_TOGGLE_LABEL = nls.localize('wordsDescription', "Match Whole Word");21const NLS_REGEX_TOGGLE_LABEL = nls.localize('regexDescription', "Use Regular Expression");2223export class CaseSensitiveToggle extends Toggle {24constructor(opts: IFindInputToggleOpts) {25super({26icon: Codicon.caseSensitive,27title: NLS_CASE_SENSITIVE_TOGGLE_LABEL + opts.appendTitle,28isChecked: opts.isChecked,29hoverLifecycleOptions: opts.hoverLifecycleOptions,30inputActiveOptionBorder: opts.inputActiveOptionBorder,31inputActiveOptionForeground: opts.inputActiveOptionForeground,32inputActiveOptionBackground: opts.inputActiveOptionBackground33});34}35}3637export class WholeWordsToggle extends Toggle {38constructor(opts: IFindInputToggleOpts) {39super({40icon: Codicon.wholeWord,41title: NLS_WHOLE_WORD_TOGGLE_LABEL + opts.appendTitle,42isChecked: opts.isChecked,43hoverLifecycleOptions: opts.hoverLifecycleOptions,44inputActiveOptionBorder: opts.inputActiveOptionBorder,45inputActiveOptionForeground: opts.inputActiveOptionForeground,46inputActiveOptionBackground: opts.inputActiveOptionBackground47});48}49}5051export class RegexToggle extends Toggle {52constructor(opts: IFindInputToggleOpts) {53super({54icon: Codicon.regex,55title: NLS_REGEX_TOGGLE_LABEL + opts.appendTitle,56isChecked: opts.isChecked,57hoverLifecycleOptions: opts.hoverLifecycleOptions,58inputActiveOptionBorder: opts.inputActiveOptionBorder,59inputActiveOptionForeground: opts.inputActiveOptionForeground,60inputActiveOptionBackground: opts.inputActiveOptionBackground61});62}63}646566