Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/base/browser/ui/findinput/findInputToggles.ts
5241 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { Toggle } from '../toggle/toggle.js';
7
import { Codicon } from '../../../common/codicons.js';
8
import * as nls from '../../../../nls.js';
9
import { type IHoverLifecycleOptions } from '../hover/hover.js';
10
11
export interface IFindInputToggleOpts {
12
readonly appendTitle: string;
13
readonly isChecked: boolean;
14
readonly inputActiveOptionBorder: string | undefined;
15
readonly inputActiveOptionForeground: string | undefined;
16
readonly inputActiveOptionBackground: string | undefined;
17
readonly hoverLifecycleOptions?: IHoverLifecycleOptions;
18
}
19
20
const NLS_CASE_SENSITIVE_TOGGLE_LABEL = nls.localize('caseDescription', "Match Case");
21
const NLS_WHOLE_WORD_TOGGLE_LABEL = nls.localize('wordsDescription', "Match Whole Word");
22
const NLS_REGEX_TOGGLE_LABEL = nls.localize('regexDescription', "Use Regular Expression");
23
24
export class CaseSensitiveToggle extends Toggle {
25
constructor(opts: IFindInputToggleOpts) {
26
super({
27
icon: Codicon.caseSensitive,
28
title: NLS_CASE_SENSITIVE_TOGGLE_LABEL + opts.appendTitle,
29
isChecked: opts.isChecked,
30
hoverLifecycleOptions: opts.hoverLifecycleOptions,
31
inputActiveOptionBorder: opts.inputActiveOptionBorder,
32
inputActiveOptionForeground: opts.inputActiveOptionForeground,
33
inputActiveOptionBackground: opts.inputActiveOptionBackground
34
});
35
}
36
}
37
38
export class WholeWordsToggle extends Toggle {
39
constructor(opts: IFindInputToggleOpts) {
40
super({
41
icon: Codicon.wholeWord,
42
title: NLS_WHOLE_WORD_TOGGLE_LABEL + opts.appendTitle,
43
isChecked: opts.isChecked,
44
hoverLifecycleOptions: opts.hoverLifecycleOptions,
45
inputActiveOptionBorder: opts.inputActiveOptionBorder,
46
inputActiveOptionForeground: opts.inputActiveOptionForeground,
47
inputActiveOptionBackground: opts.inputActiveOptionBackground
48
});
49
}
50
}
51
52
export class RegexToggle extends Toggle {
53
constructor(opts: IFindInputToggleOpts) {
54
super({
55
icon: Codicon.regex,
56
title: NLS_REGEX_TOGGLE_LABEL + opts.appendTitle,
57
isChecked: opts.isChecked,
58
hoverLifecycleOptions: opts.hoverLifecycleOptions,
59
inputActiveOptionBorder: opts.inputActiveOptionBorder,
60
inputActiveOptionForeground: opts.inputActiveOptionForeground,
61
inputActiveOptionBackground: opts.inputActiveOptionBackground
62
});
63
}
64
}
65
66