Skip to content

Commit 49cbe8c

Browse files
authored
Merge pull request microsoft#187787 from jeanp413/fix-terminal-find-action-shorcut
Fix missing terminal find widget shorcuts in tooltip
2 parents 092a43c + 6b3e4d3 commit 49cbe8c

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView
1818
import { ContextScopedFindInput } from 'vs/platform/history/browser/contextScopedHistoryWidget';
1919
import { widgetClose } from 'vs/platform/theme/common/iconRegistry';
2020
import * as strings from 'vs/base/common/strings';
21-
import { TerminalCommandId } from 'vs/workbench/contrib/terminal/common/terminal';
2221
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
2322
import { showHistoryKeybindingHint } from 'vs/platform/history/browser/historyWidgetKeybindingHint';
2423
import { status } from 'vs/base/browser/ui/aria/aria';
@@ -34,9 +33,12 @@ interface IFindOptions {
3433
showCommonFindToggles?: boolean;
3534
checkImeCompletionState?: boolean;
3635
showResultCount?: boolean;
37-
appendCaseSensitiveLabel?: string;
38-
appendRegexLabel?: string;
39-
appendWholeWordsLabel?: string;
36+
appendCaseSensitiveActionId?: string;
37+
appendRegexActionId?: string;
38+
appendWholeWordsActionId?: string;
39+
previousMatchActionId?: string;
40+
nextMatchActionId?: string;
41+
closeWidgetActionId?: string;
4042
matchesLimit?: number;
4143
type?: 'Terminal' | 'Webview';
4244
}
@@ -89,9 +91,9 @@ export abstract class SimpleFindWidget extends Widget {
8991
}
9092
},
9193
showCommonFindToggles: options.showCommonFindToggles,
92-
appendCaseSensitiveLabel: options.appendCaseSensitiveLabel && options.type === 'Terminal' ? this._getKeybinding(TerminalCommandId.ToggleFindCaseSensitive) : undefined,
93-
appendRegexLabel: options.appendRegexLabel && options.type === 'Terminal' ? this._getKeybinding(TerminalCommandId.ToggleFindRegex) : undefined,
94-
appendWholeWordsLabel: options.appendWholeWordsLabel && options.type === 'Terminal' ? this._getKeybinding(TerminalCommandId.ToggleFindWholeWord) : undefined,
94+
appendCaseSensitiveLabel: options.appendCaseSensitiveActionId ? this._getKeybinding(options.appendCaseSensitiveActionId) : undefined,
95+
appendRegexLabel: options.appendRegexActionId ? this._getKeybinding(options.appendRegexActionId) : undefined,
96+
appendWholeWordsLabel: options.appendWholeWordsActionId ? this._getKeybinding(options.appendWholeWordsActionId) : undefined,
9597
showHistoryHint: () => showHistoryKeybindingHint(_keybindingService),
9698
inputBoxStyles: defaultInputBoxStyles,
9799
toggleStyles: defaultToggleStyles
@@ -131,23 +133,23 @@ export abstract class SimpleFindWidget extends Widget {
131133
}));
132134

133135
this.prevBtn = this._register(new SimpleButton({
134-
label: NLS_PREVIOUS_MATCH_BTN_LABEL,
136+
label: NLS_PREVIOUS_MATCH_BTN_LABEL + (options.previousMatchActionId ? this._getKeybinding(options.previousMatchActionId) : ''),
135137
icon: findPreviousMatchIcon,
136138
onTrigger: () => {
137139
this.find(true);
138140
}
139141
}));
140142

141143
this.nextBtn = this._register(new SimpleButton({
142-
label: NLS_NEXT_MATCH_BTN_LABEL,
144+
label: NLS_NEXT_MATCH_BTN_LABEL + (options.nextMatchActionId ? this._getKeybinding(options.nextMatchActionId) : ''),
143145
icon: findNextMatchIcon,
144146
onTrigger: () => {
145147
this.find(false);
146148
}
147149
}));
148150

149151
const closeBtn = this._register(new SimpleButton({
150-
label: NLS_CLOSE_BTN_LABEL,
152+
label: NLS_CLOSE_BTN_LABEL + (options.closeWidgetActionId ? this._getKeybinding(options.closeWidgetActionId) : ''),
151153
icon: widgetClose,
152154
onTrigger: () => {
153155
this.hide();

src/vs/workbench/contrib/terminalContrib/find/browser/terminalFindWidget.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
1313
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
1414
import { Event } from 'vs/base/common/event';
1515
import type { ISearchOptions } from 'xterm-addon-search';
16+
import { TerminalCommandId } from 'vs/workbench/contrib/terminal/common/terminal';
1617

1718
export class TerminalFindWidget extends SimpleFindWidget {
1819
private _findInputFocused: IContextKey<boolean>;
@@ -27,7 +28,19 @@ export class TerminalFindWidget extends SimpleFindWidget {
2728
@IThemeService private readonly _themeService: IThemeService,
2829
@IConfigurationService private readonly _configurationService: IConfigurationService
2930
) {
30-
super({ showCommonFindToggles: true, checkImeCompletionState: true, showResultCount: true, type: 'Terminal', matchesLimit: XtermTerminalConstants.SearchHighlightLimit }, _contextViewService, _contextKeyService, keybindingService);
31+
super({
32+
showCommonFindToggles: true,
33+
checkImeCompletionState: true,
34+
showResultCount: true,
35+
appendCaseSensitiveActionId: TerminalCommandId.ToggleFindCaseSensitive,
36+
appendRegexActionId: TerminalCommandId.ToggleFindRegex,
37+
appendWholeWordsActionId: TerminalCommandId.ToggleFindWholeWord,
38+
previousMatchActionId: TerminalCommandId.FindPrevious,
39+
nextMatchActionId: TerminalCommandId.FindNext,
40+
closeWidgetActionId: TerminalCommandId.FindHide,
41+
type: 'Terminal',
42+
matchesLimit: XtermTerminalConstants.SearchHighlightLimit
43+
}, _contextViewService, _contextKeyService, keybindingService);
3144

3245
this._register(this.state.onFindReplaceStateChange(() => {
3346
this.show();

0 commit comments

Comments
 (0)