From 44b554db48e3cab7170aded6c2fde571def06d16 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Fri, 8 Jun 2018 17:03:06 +0200 Subject: [PATCH] #50583 Remove the existing history navigation commands --- src/vs/editor/contrib/find/findController.ts | 73 +------ src/vs/editor/contrib/find/findModel.ts | 6 +- src/vs/editor/contrib/find/findWidget.ts | 8 - .../editor/contrib/find/simpleFindWidget.ts | 20 +- src/vs/platform/widget/browser/input.ts | 40 ---- .../electron-browser/main.contribution.ts | 5 + .../removedKeybindingsContribution.ts | 75 +++++++ .../electron-browser/extensionEditor.ts | 57 +---- .../parts/search/browser/searchActions.ts | 203 ------------------ .../electron-browser/search.contribution.ts | 16 +- .../terminal/browser/terminalFindWidget.ts | 10 +- .../parts/terminal/common/terminal.ts | 2 - .../parts/terminal/common/terminalService.ts | 2 - .../electron-browser/terminal.contribution.ts | 8 +- .../electron-browser/terminalActions.ts | 35 --- .../electron-browser/terminalPanel.ts | 8 - .../electron-browser/terminalService.ts | 14 -- .../electron-browser/baseWebviewEditor.ts | 12 -- .../electron-browser/webview.contribution.ts | 18 +- .../electron-browser/webviewCommands.ts | 21 +- .../electron-browser/webviewElement.ts | 8 - .../electron-browser/webviewFindWidget.ts | 10 +- 22 files changed, 96 insertions(+), 555 deletions(-) create mode 100644 src/vs/workbench/electron-browser/removedKeybindingsContribution.ts diff --git a/src/vs/editor/contrib/find/findController.ts b/src/vs/editor/contrib/find/findController.ts index a6d3696296e..73bf698e3b8 100644 --- a/src/vs/editor/contrib/find/findController.ts +++ b/src/vs/editor/contrib/find/findController.ts @@ -7,11 +7,11 @@ import * as nls from 'vs/nls'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { Disposable } from 'vs/base/common/lifecycle'; -import { ContextKeyExpr, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; +import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import * as strings from 'vs/base/common/strings'; import * as editorCommon from 'vs/editor/common/editorCommon'; import { registerEditorContribution, registerEditorAction, ServicesAccessor, EditorAction, EditorCommand, registerEditorCommand } from 'vs/editor/browser/editorExtensions'; -import { FIND_IDS, FindModelBoundToEditorModel, ToggleCaseSensitiveKeybinding, ToggleRegexKeybinding, ToggleWholeWordKeybinding, ToggleSearchScopeKeybinding, CONTEXT_FIND_WIDGET_VISIBLE, CONTEXT_FIND_INPUT_FOCUSED } from 'vs/editor/contrib/find/findModel'; +import { FIND_IDS, FindModelBoundToEditorModel, ToggleCaseSensitiveKeybinding, ToggleRegexKeybinding, ToggleWholeWordKeybinding, ToggleSearchScopeKeybinding, CONTEXT_FIND_WIDGET_VISIBLE } from 'vs/editor/contrib/find/findModel'; import { FindReplaceState, FindReplaceStateChangedEvent, INewFindReplaceState } from 'vs/editor/contrib/find/findState'; import { Delayer } from 'vs/base/common/async'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; @@ -25,8 +25,6 @@ import { FindOptionsWidget } from 'vs/editor/contrib/find/findOptionsWidget'; import { IThemeService } from 'vs/platform/theme/common/themeService'; import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { optional } from 'vs/platform/instantiation/common/instantiation'; -import { INotificationService } from 'vs/platform/notification/common/notification'; -import { showDeprecatedWarning } from 'vs/platform/widget/browser/input'; export function getSelectionSearchString(editor: ICodeEditor): string { let selection = editor.getSelection(); @@ -310,16 +308,6 @@ export class CommonFindController extends Disposable implements editorCommon.IEd return false; } - public showPreviousFindTerm(): boolean { - // overwritten in subclass - return false; - } - - public showNextFindTerm(): boolean { - // overwritten in subclass - return false; - } - public getGlobalBufferTerm(): string { if (this._editor.getConfiguration().contribInfo.find.globalFindClipboard && this._clipboardService @@ -352,7 +340,6 @@ export class FindController extends CommonFindController implements IFindControl @IKeybindingService private readonly _keybindingService: IKeybindingService, @IThemeService private readonly _themeService: IThemeService, @IStorageService storageService: IStorageService, - @INotificationService private readonly _notificationService: INotificationService, @optional(IClipboardService) clipboardService: IClipboardService ) { super(editor, _contextKeyService, storageService, clipboardService); @@ -387,18 +374,6 @@ export class FindController extends CommonFindController implements IFindControl this._widget = this._register(new FindWidget(this._editor, this, this._state, this._contextViewService, this._keybindingService, this._contextKeyService, this._themeService)); this._findOptionsWidget = this._register(new FindOptionsWidget(this._editor, this._state, this._keybindingService, this._themeService)); } - - public showPreviousFindTerm(): boolean { - showDeprecatedWarning(this._notificationService, this._keybindingService, this._storageService); - this._widget.showPreviousFindTerm(); - return true; - } - - public showNextFindTerm(): boolean { - showDeprecatedWarning(this._notificationService, this._keybindingService, this._storageService); - this._widget.showNextFindTerm(); - return true; - } } export class StartFindAction extends EditorAction { @@ -632,48 +607,6 @@ export class StartFindReplaceAction extends EditorAction { } } -export class ShowNextFindTermAction extends MatchFindAction { - - constructor() { - super({ - id: FIND_IDS.ShowNextFindTermAction, - label: nls.localize('showNextFindTermAction', "Show Next Find Term"), - alias: 'Show Next Find Term', - precondition: CONTEXT_FIND_WIDGET_VISIBLE, - kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(5), - kbExpr: ContextKeyExpr.and(CONTEXT_FIND_INPUT_FOCUSED, EditorContextKeys.focus), - primary: null - } - }); - } - - protected _run(controller: CommonFindController): boolean { - return controller.showNextFindTerm(); - } -} - -export class ShowPreviousFindTermAction extends MatchFindAction { - - constructor() { - super({ - id: FIND_IDS.ShowPreviousFindTermAction, - label: nls.localize('showPreviousFindTermAction', "Show Previous Find Term"), - alias: 'Find Show Previous Find Term', - precondition: CONTEXT_FIND_WIDGET_VISIBLE, - kbOpts: { - weight: KeybindingsRegistry.WEIGHT.editorContrib(5), - kbExpr: ContextKeyExpr.and(CONTEXT_FIND_INPUT_FOCUSED, EditorContextKeys.focus), - primary: null - } - }); - } - - protected _run(controller: CommonFindController): boolean { - return controller.showPreviousFindTerm(); - } -} - registerEditorContribution(FindController); registerEditorAction(StartFindAction); @@ -683,8 +616,6 @@ registerEditorAction(PreviousMatchFindAction); registerEditorAction(NextSelectionMatchFindAction); registerEditorAction(PreviousSelectionMatchFindAction); registerEditorAction(StartFindReplaceAction); -registerEditorAction(ShowNextFindTermAction); -registerEditorAction(ShowPreviousFindTermAction); const FindCommand = EditorCommand.bindToContribution(CommonFindController.get); diff --git a/src/vs/editor/contrib/find/findModel.ts b/src/vs/editor/contrib/find/findModel.ts index adf724d394e..bf51ac38ce5 100644 --- a/src/vs/editor/contrib/find/findModel.ts +++ b/src/vs/editor/contrib/find/findModel.ts @@ -62,11 +62,7 @@ export const FIND_IDS = { ToggleSearchScopeCommand: 'toggleFindInSelection', ReplaceOneAction: 'editor.action.replaceOne', ReplaceAllAction: 'editor.action.replaceAll', - SelectAllMatchesAction: 'editor.action.selectAllMatches', - ShowPreviousFindTermAction: 'find.history.showPrevious', - ShowNextFindTermAction: 'find.history.showNext', - ShowPreviousReplaceTermAction: 'replace.history.showPrevious', - ShowNextReplaceTermAction: 'replace.history.showNext' + SelectAllMatchesAction: 'editor.action.selectAllMatches' }; export const MATCHES_LIMIT = 19999; diff --git a/src/vs/editor/contrib/find/findWidget.ts b/src/vs/editor/contrib/find/findWidget.ts index 82b25e526c5..151e0ddba11 100644 --- a/src/vs/editor/contrib/find/findWidget.ts +++ b/src/vs/editor/contrib/find/findWidget.ts @@ -244,14 +244,6 @@ export class FindWidget extends Widget implements IOverlayWidget, IHorizontalSas return null; } - public showNextFindTerm() { - this._findInput.inputBox.showNextValue(); - } - - public showPreviousFindTerm() { - this._findInput.inputBox.showPreviousValue(); - } - // ----- React to state changes private _onStateChanged(e: FindReplaceStateChangedEvent): void { diff --git a/src/vs/editor/contrib/find/simpleFindWidget.ts b/src/vs/editor/contrib/find/simpleFindWidget.ts index 44f7066321e..04f66665356 100644 --- a/src/vs/editor/contrib/find/simpleFindWidget.ts +++ b/src/vs/editor/contrib/find/simpleFindWidget.ts @@ -14,11 +14,8 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView import { registerThemingParticipant, ITheme } from 'vs/platform/theme/common/themeService'; import { inputBackground, inputActiveOptionBorder, inputForeground, inputBorder, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationErrorBackground, inputValidationErrorBorder, editorWidgetBackground, widgetShadow } from 'vs/platform/theme/common/colorRegistry'; import { SimpleButton } from './findWidget'; -import { ContextScopedFindInput, showDeprecatedWarning } from 'vs/platform/widget/browser/input'; +import { ContextScopedFindInput } from 'vs/platform/widget/browser/input'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { INotificationService } from 'vs/platform/notification/common/notification'; -import { IStorageService } from 'vs/platform/storage/common/storage'; const NLS_FIND_INPUT_LABEL = nls.localize('label.find', "Find"); const NLS_FIND_INPUT_PLACEHOLDER = nls.localize('placeholder.find', "Find"); @@ -37,10 +34,7 @@ export abstract class SimpleFindWidget extends Widget { constructor( @IContextViewService private readonly _contextViewService: IContextViewService, - @IContextKeyService contextKeyService: IContextKeyService, - @IKeybindingService private readonly _keybindingService: IKeybindingService, - @INotificationService private readonly _notificationService: INotificationService, - @IStorageService private readonly _storageService: IStorageService + @IContextKeyService contextKeyService: IContextKeyService ) { super(); @@ -206,16 +200,6 @@ export abstract class SimpleFindWidget extends Widget { this._findInput.inputBox.addToHistory(this._findInput.getValue()); } } - - public showNextFindTerm() { - showDeprecatedWarning(this._notificationService, this._keybindingService, this._storageService); - this._findInput.inputBox.showNextValue(); - } - - public showPreviousFindTerm() { - showDeprecatedWarning(this._notificationService, this._keybindingService, this._storageService); - this._findInput.inputBox.showPreviousValue(); - } } // theming diff --git a/src/vs/platform/widget/browser/input.ts b/src/vs/platform/widget/browser/input.ts index 51cdcbb5b72..d0598517aff 100644 --- a/src/vs/platform/widget/browser/input.ts +++ b/src/vs/platform/widget/browser/input.ts @@ -9,11 +9,6 @@ import { HistoryInputBox, IHistoryInputOptions } from 'vs/base/browser/ui/inputb import { FindInput, IFindInputOptions } from 'vs/base/browser/ui/findinput/findInput'; import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview'; import { createWidgetScopedContextKeyService, IWidget } from 'vs/platform/widget/browser/widget'; -import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; -import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; -import { ResolvedKeybindingItem } from 'vs/platform/keybinding/common/resolvedKeybindingItem'; -import { localize } from 'vs/nls'; export const HistoryInputBoxContext = 'historyInputBox'; @@ -36,39 +31,4 @@ export class ContextScopedFindInput extends FindInput { this._register(createWidgetScopedContextKeyService(contextKeyService, this.inputBox, HistoryInputBoxContext)); } -} - -export function showDeprecatedWarning(notificationService: INotificationService, keybindingService: IKeybindingService, storageService: IStorageService): void { - const previousCommand = 'input.action.historyPrevious'; - const nextCommand = 'input.action.historyNext'; - let previousKeybinding: ResolvedKeybindingItem, nextKeybinding: ResolvedKeybindingItem; - for (const keybinding of keybindingService.getKeybindings()) { - if (keybinding.command === previousCommand) { - if (!keybinding.isDefault) { - return; - } - previousKeybinding = keybinding; - } - if (keybinding.command === nextCommand) { - if (!keybinding.isDefault) { - return; - } - nextKeybinding = keybinding; - } - } - const key = 'donotshow.historyNavigation.warning'; - if (!storageService.getBoolean(key, StorageScope.GLOBAL, false)) { - const message = localize('showDeprecatedWarningMessage', "History navigation commands you are using are deprecated. Instead use following new commands: {0} and {1}", `${previousCommand} (${previousKeybinding.resolvedKeybinding.getLabel()})`, `${nextCommand} (${nextKeybinding.resolvedKeybinding.getLabel()})`); - notificationService.prompt(Severity.Warning, message, [ - { - label: localize('more information', "More Information..."), - run: () => null - }, - { - label: localize('Do not show again', "Don't show again"), - isSecondary: true, - run: () => storageService.store(key, true, StorageScope.GLOBAL) - } - ]); - } } \ No newline at end of file diff --git a/src/vs/workbench/electron-browser/main.contribution.ts b/src/vs/workbench/electron-browser/main.contribution.ts index a75f5da965b..0462a5e555e 100644 --- a/src/vs/workbench/electron-browser/main.contribution.ts +++ b/src/vs/workbench/electron-browser/main.contribution.ts @@ -22,6 +22,9 @@ import { inQuickOpenContext, getQuickNavigateHandler } from 'vs/workbench/browse import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { CommandsRegistry } from 'vs/platform/commands/common/commands'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; +import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; +import { HistoryNavigationKeybindingsChangedContribution } from 'vs/workbench/electron-browser/removedKeybindingsContribution'; // Contribute Commands registerCommands(); @@ -501,3 +504,5 @@ configurationRegistry.registerConfiguration({ } } }); + +Registry.as(WorkbenchExtensions.Workbench).registerWorkbenchContribution(HistoryNavigationKeybindingsChangedContribution, LifecyclePhase.Eventually); diff --git a/src/vs/workbench/electron-browser/removedKeybindingsContribution.ts b/src/vs/workbench/electron-browser/removedKeybindingsContribution.ts new file mode 100644 index 00000000000..e50396c7615 --- /dev/null +++ b/src/vs/workbench/electron-browser/removedKeybindingsContribution.ts @@ -0,0 +1,75 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +'use strict'; + +import { IWorkbenchContribution } from 'vs/workbench/common/contributions'; +import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; +import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; +import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage'; +import { localize } from 'vs/nls'; +import { IPreferencesService } from 'vs/workbench/services/preferences/common/preferences'; + +export class HistoryNavigationKeybindingsChangedContribution implements IWorkbenchContribution { + + private previousCommands: string[] = [ + + 'search.history.showNextIncludePattern', + 'search.history.showPreviousIncludePattern', + 'search.history.showNextExcludePattern', + 'search.history.showPreviousExcludePattern', + 'search.history.showNext', + 'search.history.showPrevious', + 'search.replaceHistory.showNext', + 'search.replaceHistory.showPrevious', + + 'find.history.showPrevious', + 'find.history.showNext', + + 'workbench.action.terminal.findWidget.history.showNext', + 'workbench.action.terminal.findWidget.history.showPrevious', + + 'editor.action.extensioneditor.showNextFindTerm', + 'editor.action.extensioneditor.showPreviousFindTerm', + + 'editor.action.webvieweditor.showNextFindTerm', + 'editor.action.webvieweditor.showPreviousFindTerm' + + ]; + + constructor( + @INotificationService private readonly notificationService: INotificationService, + @IKeybindingService private readonly keybindingService: IKeybindingService, + @IPreferencesService private readonly preferencesService: IPreferencesService, + @IStorageService private readonly storageService: IStorageService + ) { + this.showRemovedWarning(); + } + + private showRemovedWarning(): void { + const key = 'donotshow.historyNavigation.warning'; + if (!this.storageService.getBoolean(key, StorageScope.GLOBAL, false)) { + const keybindingsToRemove = this.keybindingService.getKeybindings().filter(keybinding => !keybinding.isDefault && this.previousCommands.indexOf(keybinding.command) !== -1); + if (keybindingsToRemove.length) { + const message = localize('showDeprecatedWarningMessage', "History navigation commands have changed. Please update your keybindings to use following new commands: 'input.action.historyPrevious' and 'input.action.historyNext'"); + this.notificationService.prompt(Severity.Warning, message, [ + { + label: localize('Open Keybindings', "Open Keybindings File"), + run: () => this.preferencesService.openGlobalKeybindingSettings(true) + }, + { + label: localize('more information', "More Information..."), + run: () => null + }, + { + label: localize('Do not show again', "Don't show again"), + isSecondary: true, + run: () => this.storageService.store(key, true, StorageScope.GLOBAL) + } + ]); + } + } + } +} \ No newline at end of file diff --git a/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts b/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts index f6120fd51f7..a1dad788f00 100644 --- a/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts +++ b/src/vs/workbench/parts/extensions/electron-browser/extensionEditor.ts @@ -42,7 +42,7 @@ import { IPartService, Parts } from 'vs/workbench/services/part/common/partServi import { IThemeService } from 'vs/platform/theme/common/themeService'; import { KeybindingLabel } from 'vs/base/browser/ui/keybindingLabel/keybindingLabel'; import { IContextKeyService, RawContextKey, IContextKey } from 'vs/platform/contextkey/common/contextkey'; -import { Command, ICommandOptions } from 'vs/editor/browser/editorExtensions'; +import { Command } from 'vs/editor/browser/editorExtensions'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { Color } from 'vs/base/common/color'; @@ -388,18 +388,6 @@ export class ExtensionEditor extends BaseEditor { } } - public showNextFindTerm() { - if (this.activeWebview) { - this.activeWebview.showNextFindTerm(); - } - } - - public showPreviousFindTerm() { - if (this.activeWebview) { - this.activeWebview.showPreviousFindTerm(); - } - } - private onNavbarChange(extension: IExtension, id: string): void { if (this.editorLoadComplete) { /* __GDPR__ @@ -1003,46 +991,3 @@ const showCommand = new ShowExtensionEditorFindCommand({ } }); KeybindingsRegistry.registerCommandAndKeybindingRule(showCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); - -class ShowExtensionEditorFindTermCommand extends Command { - constructor(opts: ICommandOptions, private _next: boolean) { - super(opts); - } - - public runCommand(accessor: ServicesAccessor, args: any): void { - const extensionEditor = this.getExtensionEditor(accessor); - if (extensionEditor) { - if (this._next) { - extensionEditor.showNextFindTerm(); - } else { - extensionEditor.showPreviousFindTerm(); - } - } - } - - private getExtensionEditor(accessor: ServicesAccessor): ExtensionEditor { - const activeControl = accessor.get(IEditorService).activeControl as ExtensionEditor; - if (activeControl instanceof ExtensionEditor) { - return activeControl; - } - return null; - } -} - -const showNextFindTermCommand = new ShowExtensionEditorFindTermCommand({ - id: 'editor.action.extensioneditor.showNextFindTerm', - precondition: KEYBINDING_CONTEXT_EXTENSIONEDITOR_FIND_WIDGET_INPUT_FOCUSED, - kbOpts: { - primary: KeyMod.Alt | KeyCode.DownArrow - } -}, true); -KeybindingsRegistry.registerCommandAndKeybindingRule(showNextFindTermCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); - -const showPreviousFindTermCommand = new ShowExtensionEditorFindTermCommand({ - id: 'editor.action.extensioneditor.showPreviousFindTerm', - precondition: KEYBINDING_CONTEXT_EXTENSIONEDITOR_FIND_WIDGET_INPUT_FOCUSED, - kbOpts: { - primary: KeyMod.Alt | KeyCode.UpArrow - } -}, false); -KeybindingsRegistry.registerCommandAndKeybindingRule(showPreviousFindTermCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); diff --git a/src/vs/workbench/parts/search/browser/searchActions.ts b/src/vs/workbench/parts/search/browser/searchActions.ts index c9d05ffe457..8ff668392e3 100644 --- a/src/vs/workbench/parts/search/browser/searchActions.ts +++ b/src/vs/workbench/parts/search/browser/searchActions.ts @@ -16,7 +16,6 @@ import { ITree } from 'vs/base/parts/tree/browser/tree'; import * as nls from 'vs/nls'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; import { ICommandHandler } from 'vs/platform/commands/common/commands'; -import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; import { ISearchHistoryService, VIEW_ID } from 'vs/platform/search/common/search'; @@ -27,9 +26,6 @@ import { FileMatch, FileMatchOrMatch, FolderMatch, Match, RenderableMatch, searc import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet'; -import { INotificationService } from 'vs/platform/notification/common/notification'; -import { IStorageService } from 'vs/platform/storage/common/storage'; -import { showDeprecatedWarning } from 'vs/platform/widget/browser/input'; export function isSearchViewFocused(viewletService: IViewletService, panelService: IPanelService): boolean { let searchView = getSearchView(viewletService, panelService); @@ -87,205 +83,6 @@ export const toggleRegexCommand = (accessor: ServicesAccessor) => { searchView.toggleRegex(); }; -export class ShowNextSearchIncludeAction extends Action { - - public static readonly ID = 'search.history.showNextIncludePattern'; - public static readonly LABEL = nls.localize('nextSearchIncludePattern', "Show Next Search Include Pattern"); - - constructor(id: string, label: string, - @IViewletService private viewletService: IViewletService, - @IPanelService private panelService: IPanelService, - @IContextKeyService private contextKeyService: IContextKeyService, - @IKeybindingService private keybindingService: IKeybindingService, - @INotificationService private notificationService: INotificationService, - @IStorageService private storageService: IStorageService - ) { - super(id, label); - this.enabled = this.contextKeyService.contextMatchesRules(Constants.SearchViewVisibleKey); - } - - public run(): TPromise { - showDeprecatedWarning(this.notificationService, this.keybindingService, this.storageService); - const searchView = getSearchView(this.viewletService, this.panelService); - searchView.searchIncludePattern.showNextTerm(); - return TPromise.as(null); - } -} - -export class ShowPreviousSearchIncludeAction extends Action { - - public static readonly ID = 'search.history.showPreviousIncludePattern'; - public static readonly LABEL = nls.localize('previousSearchIncludePattern', "Show Previous Search Include Pattern"); - - constructor(id: string, label: string, - @IViewletService private viewletService: IViewletService, - @IPanelService private panelService: IPanelService, - @IContextKeyService private contextKeyService: IContextKeyService, - @INotificationService private notificationService: INotificationService, - @IKeybindingService private keybindingService: IKeybindingService, - @IStorageService private storageService: IStorageService - ) { - super(id, label); - this.enabled = this.contextKeyService.contextMatchesRules(Constants.SearchViewVisibleKey); - } - - public run(): TPromise { - showDeprecatedWarning(this.notificationService, this.keybindingService, this.storageService); - const searchView = getSearchView(this.viewletService, this.panelService); - searchView.searchIncludePattern.showPreviousTerm(); - return TPromise.as(null); - } -} - -export class ShowNextSearchExcludeAction extends Action { - - public static readonly ID = 'search.history.showNextExcludePattern'; - public static readonly LABEL = nls.localize('nextSearchExcludePattern', "Show Next Search Exclude Pattern"); - - constructor(id: string, label: string, - @IViewletService private viewletService: IViewletService, - @IPanelService private panelService: IPanelService, - @IContextKeyService private contextKeyService: IContextKeyService, - @INotificationService private notificationService: INotificationService, - @IKeybindingService private keybindingService: IKeybindingService, - @IStorageService private storageService: IStorageService - ) { - super(id, label); - this.enabled = this.contextKeyService.contextMatchesRules(Constants.SearchViewVisibleKey); - } - - public run(): TPromise { - showDeprecatedWarning(this.notificationService, this.keybindingService, this.storageService); - const searchView = getSearchView(this.viewletService, this.panelService); - searchView.searchExcludePattern.showNextTerm(); - return TPromise.as(null); - } -} - -export class ShowPreviousSearchExcludeAction extends Action { - - public static readonly ID = 'search.history.showPreviousExcludePattern'; - public static readonly LABEL = nls.localize('previousSearchExcludePattern', "Show Previous Search Exclude Pattern"); - - constructor(id: string, label: string, - @IViewletService private viewletService: IViewletService, - @IContextKeyService private contextKeyService: IContextKeyService, - @IPanelService private panelService: IPanelService, - @INotificationService private notificationService: INotificationService, - @IKeybindingService private keybindingService: IKeybindingService, - @IStorageService private storageService: IStorageService - ) { - super(id, label); - this.enabled = this.contextKeyService.contextMatchesRules(Constants.SearchViewVisibleKey); - } - - public run(): TPromise { - showDeprecatedWarning(this.notificationService, this.keybindingService, this.storageService); - const searchView = getSearchView(this.viewletService, this.panelService); - searchView.searchExcludePattern.showPreviousTerm(); - return TPromise.as(null); - } -} - -export class ShowNextSearchTermAction extends Action { - - public static readonly ID = 'search.history.showNext'; - public static readonly LABEL = nls.localize('nextSearchTerm', "Show Next Search Term"); - - constructor(id: string, label: string, - @IViewletService private viewletService: IViewletService, - @IContextKeyService private contextKeyService: IContextKeyService, - @IPanelService private panelService: IPanelService, - @INotificationService private notificationService: INotificationService, - @IKeybindingService private keybindingService: IKeybindingService, - @IStorageService private storageService: IStorageService - ) { - super(id, label); - this.enabled = this.contextKeyService.contextMatchesRules(Constants.SearchViewVisibleKey); - } - - public run(): TPromise { - showDeprecatedWarning(this.notificationService, this.keybindingService, this.storageService); - const searchView = getSearchView(this.viewletService, this.panelService); - searchView.searchAndReplaceWidget.showNextSearchTerm(); - return TPromise.as(null); - } -} - -export class ShowPreviousSearchTermAction extends Action { - - public static readonly ID = 'search.history.showPrevious'; - public static readonly LABEL = nls.localize('previousSearchTerm', "Show Previous Search Term"); - - constructor(id: string, label: string, - @IViewletService private viewletService: IViewletService, - @IContextKeyService private contextKeyService: IContextKeyService, - @IPanelService private panelService: IPanelService, - @INotificationService private notificationService: INotificationService, - @IKeybindingService private keybindingService: IKeybindingService, - @IStorageService private storageService: IStorageService - ) { - super(id, label); - this.enabled = this.contextKeyService.contextMatchesRules(Constants.SearchViewVisibleKey); - } - - public run(): TPromise { - showDeprecatedWarning(this.notificationService, this.keybindingService, this.storageService); - const searchView = getSearchView(this.viewletService, this.panelService); - searchView.searchAndReplaceWidget.showPreviousSearchTerm(); - return TPromise.as(null); - } -} -export class ShowNextReplaceTermAction extends Action { - - public static readonly ID = 'search.replaceHistory.showNext'; - public static readonly LABEL = nls.localize('nextReplaceTerm', "Show Next Search Replace Term"); - - constructor(id: string, label: string, - @IViewletService private viewletService: IViewletService, - @IContextKeyService private contextKeyService: IContextKeyService, - @IPanelService private panelService: IPanelService, - @INotificationService private notificationService: INotificationService, - @IKeybindingService private keybindingService: IKeybindingService, - @IStorageService private storageService: IStorageService - ) { - super(id, label); - this.enabled = this.contextKeyService.contextMatchesRules(Constants.SearchViewVisibleKey); - } - - public run(): TPromise { - showDeprecatedWarning(this.notificationService, this.keybindingService, this.storageService); - const searchView = getSearchView(this.viewletService, this.panelService); - searchView.searchAndReplaceWidget.showNextReplaceTerm(); - return TPromise.as(null); - } -} - -export class ShowPreviousReplaceTermAction extends Action { - - public static readonly ID = 'search.replaceHistory.showPrevious'; - public static readonly LABEL = nls.localize('previousReplaceTerm', "Show Previous Search Replace Term"); - - constructor(id: string, label: string, - @IViewletService private viewletService: IViewletService, - @IContextKeyService private contextKeyService: IContextKeyService, - @IPanelService private panelService: IPanelService, - @INotificationService private notificationService: INotificationService, - @IKeybindingService private keybindingService: IKeybindingService, - @IStorageService private storageService: IStorageService - ) { - super(id, label); - this.enabled = this.contextKeyService.contextMatchesRules(Constants.SearchViewVisibleKey); - } - - public run(): TPromise { - showDeprecatedWarning(this.notificationService, this.keybindingService, this.storageService); - const searchView = getSearchView(this.viewletService, this.panelService); - searchView.searchAndReplaceWidget.showPreviousReplaceTerm(); - return TPromise.as(null); - } -} - export const FocusActiveEditorCommand = (accessor: ServicesAccessor) => { const editorService = accessor.get(IEditorService); const activeControl = editorService.activeControl; diff --git a/src/vs/workbench/parts/search/electron-browser/search.contribution.ts b/src/vs/workbench/parts/search/electron-browser/search.contribution.ts index f3a49be3e98..348b7a8b542 100644 --- a/src/vs/workbench/parts/search/electron-browser/search.contribution.ts +++ b/src/vs/workbench/parts/search/electron-browser/search.contribution.ts @@ -52,7 +52,7 @@ import { getMultiSelectedResources } from 'vs/workbench/parts/files/browser/file import { Schemas } from 'vs/base/common/network'; import { PanelRegistry, Extensions as PanelExtensions, PanelDescriptor } from 'vs/workbench/browser/panel'; import { IPanelService } from 'vs/workbench/services/panel/common/panelService'; -import { openSearchView, getSearchView, ReplaceAllInFolderAction, ReplaceAllAction, CloseReplaceAction, FocusNextSearchResultAction, FocusPreviousSearchResultAction, ReplaceInFilesAction, FindInFilesAction, FocusActiveEditorCommand, toggleCaseSensitiveCommand, ShowNextSearchTermAction, ShowPreviousSearchTermAction, toggleRegexCommand, ShowPreviousSearchIncludeAction, ShowNextSearchIncludeAction, CollapseDeepestExpandedLevelAction, toggleWholeWordCommand, RemoveAction, ReplaceAction, ClearSearchResultsAction, copyPathCommand, copyMatchCommand, copyAllCommand, ShowNextSearchExcludeAction, ShowPreviousSearchExcludeAction, clearHistoryCommand, ShowNextReplaceTermAction, ShowPreviousReplaceTermAction } from 'vs/workbench/parts/search/browser/searchActions'; +import { openSearchView, getSearchView, ReplaceAllInFolderAction, ReplaceAllAction, CloseReplaceAction, FocusNextSearchResultAction, FocusPreviousSearchResultAction, ReplaceInFilesAction, FindInFilesAction, FocusActiveEditorCommand, toggleCaseSensitiveCommand, toggleRegexCommand, CollapseDeepestExpandedLevelAction, toggleWholeWordCommand, RemoveAction, ReplaceAction, ClearSearchResultsAction, copyPathCommand, copyMatchCommand, copyAllCommand, clearHistoryCommand } from 'vs/workbench/parts/search/browser/searchActions'; import { VIEW_ID, ISearchConfigurationProperties } from 'vs/platform/search/common/search'; import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; @@ -471,21 +471,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule(objects.assign({ handler: toggleRegexCommand }, ToggleRegexKeybinding)); -// Terms navigation actions -registry.registerWorkbenchAction(new SyncActionDescriptor(ShowNextSearchTermAction, ShowNextSearchTermAction.ID, ShowNextSearchTermAction.LABEL, null, ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.SearchInputBoxFocusedKey)), 'Search: Show Next Search Term', category); -registry.registerWorkbenchAction(new SyncActionDescriptor(ShowPreviousSearchTermAction, ShowPreviousSearchTermAction.ID, ShowPreviousSearchTermAction.LABEL, null, ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.SearchInputBoxFocusedKey)), 'Search: Show Previous Search Term', category); - -registry.registerWorkbenchAction(new SyncActionDescriptor(ShowNextReplaceTermAction, ShowNextReplaceTermAction.ID, ShowNextReplaceTermAction.LABEL, null, ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.ReplaceInputBoxFocusedKey)), 'Search: Show Next Search Replace Term', category); -registry.registerWorkbenchAction(new SyncActionDescriptor(ShowPreviousReplaceTermAction, ShowPreviousReplaceTermAction.ID, ShowPreviousReplaceTermAction.LABEL, null, ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.ReplaceInputBoxFocusedKey)), 'Search: Show Previous Search Replace Term', category); - -registry.registerWorkbenchAction(new SyncActionDescriptor(ShowNextSearchIncludeAction, ShowNextSearchIncludeAction.ID, ShowNextSearchIncludeAction.LABEL, null, ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.PatternIncludesFocusedKey)), 'Search: Show Next Search Include Pattern', category); -registry.registerWorkbenchAction(new SyncActionDescriptor(ShowPreviousSearchIncludeAction, ShowPreviousSearchIncludeAction.ID, ShowPreviousSearchIncludeAction.LABEL, null, ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.PatternIncludesFocusedKey)), 'Search: Show Previous Search Include Pattern', category); - -registry.registerWorkbenchAction(new SyncActionDescriptor(ShowNextSearchExcludeAction, ShowNextSearchExcludeAction.ID, ShowNextSearchExcludeAction.LABEL, null, ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.PatternExcludesFocusedKey)), 'Search: Show Next Search Exclude Pattern', category); -registry.registerWorkbenchAction(new SyncActionDescriptor(ShowPreviousSearchExcludeAction, ShowPreviousSearchExcludeAction.ID, ShowPreviousSearchExcludeAction.LABEL, null, ContextKeyExpr.and(Constants.SearchViewVisibleKey, Constants.PatternExcludesFocusedKey)), 'Search: Show Previous Search Exclude Pattern', category); - registry.registerWorkbenchAction(new SyncActionDescriptor(CollapseDeepestExpandedLevelAction, CollapseDeepestExpandedLevelAction.ID, CollapseDeepestExpandedLevelAction.LABEL), 'Search: Collapse All', category); - registry.registerWorkbenchAction(new SyncActionDescriptor(ShowAllSymbolsAction, ShowAllSymbolsAction.ID, ShowAllSymbolsAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_T }), 'Go to Symbol in Workspace...'); diff --git a/src/vs/workbench/parts/terminal/browser/terminalFindWidget.ts b/src/vs/workbench/parts/terminal/browser/terminalFindWidget.ts index 7558aa6baef..a152219e504 100644 --- a/src/vs/workbench/parts/terminal/browser/terminalFindWidget.ts +++ b/src/vs/workbench/parts/terminal/browser/terminalFindWidget.ts @@ -7,9 +7,6 @@ import { SimpleFindWidget } from 'vs/editor/contrib/find/simpleFindWidget'; import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; import { ITerminalService, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_INPUT_FOCUSED } from 'vs/workbench/parts/terminal/common/terminal'; import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey'; -import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { INotificationService } from 'vs/platform/notification/common/notification'; -import { IStorageService } from 'vs/platform/storage/common/storage'; export class TerminalFindWidget extends SimpleFindWidget { protected _findInputFocused: IContextKey; @@ -17,12 +14,9 @@ export class TerminalFindWidget extends SimpleFindWidget { constructor( @IContextViewService _contextViewService: IContextViewService, @IContextKeyService private readonly _contextKeyService: IContextKeyService, - @ITerminalService private readonly _terminalService: ITerminalService, - @IKeybindingService keybindingService: IKeybindingService, - @INotificationService notificationService: INotificationService, - @IStorageService storageService: IStorageService + @ITerminalService private readonly _terminalService: ITerminalService ) { - super(_contextViewService, _contextKeyService, keybindingService, notificationService, storageService); + super(_contextViewService, _contextKeyService); this._findInputFocused = KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_INPUT_FOCUSED.bindTo(this._contextKeyService); } diff --git a/src/vs/workbench/parts/terminal/common/terminal.ts b/src/vs/workbench/parts/terminal/common/terminal.ts index 4ca2847cbf8..11d3de98e8f 100644 --- a/src/vs/workbench/parts/terminal/common/terminal.ts +++ b/src/vs/workbench/parts/terminal/common/terminal.ts @@ -203,8 +203,6 @@ export interface ITerminalService { hidePanel(): void; focusFindWidget(): TPromise; hideFindWidget(): void; - showNextFindTermFindWidget(): void; - showPreviousFindTermFindWidget(): void; setContainers(panelContainer: HTMLElement, terminalContainer: HTMLElement): void; selectDefaultWindowsShell(): TPromise; diff --git a/src/vs/workbench/parts/terminal/common/terminalService.ts b/src/vs/workbench/parts/terminal/common/terminalService.ts index e294388516b..f5cc15c8b42 100644 --- a/src/vs/workbench/parts/terminal/common/terminalService.ts +++ b/src/vs/workbench/parts/terminal/common/terminalService.ts @@ -342,8 +342,6 @@ export abstract class TerminalService implements ITerminalService { public abstract focusFindWidget(): TPromise; public abstract hideFindWidget(): void; - public abstract showNextFindTermFindWidget(): void; - public abstract showPreviousFindTermFindWidget(): void; private _getIndexFromId(terminalId: number): number { let terminalIndex = -1; diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts index 829b625ca71..8c4a8bdf11d 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminal.contribution.ts @@ -13,12 +13,12 @@ import * as panel from 'vs/workbench/browser/panel'; import * as platform from 'vs/base/common/platform'; import * as terminalCommands from 'vs/workbench/parts/terminal/common/terminalCommands'; import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; -import { ITerminalService, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_INPUT_FOCUSED, KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED, TERMINAL_PANEL_ID, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE, TerminalCursorStyle, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_NOT_VISIBLE, DEFAULT_LINE_HEIGHT, DEFAULT_LETTER_SPACING } from 'vs/workbench/parts/terminal/common/terminal'; +import { ITerminalService, KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_TEXT_SELECTED, TERMINAL_PANEL_ID, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE, TerminalCursorStyle, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_NOT_VISIBLE, DEFAULT_LINE_HEIGHT, DEFAULT_LETTER_SPACING } from 'vs/workbench/parts/terminal/common/terminal'; import { getTerminalDefaultShellUnixLike, getTerminalDefaultShellWindows } from 'vs/workbench/parts/terminal/node/terminal'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; -import { KillTerminalAction, ClearSelectionTerminalAction, CopyTerminalSelectionAction, CreateNewTerminalAction, CreateNewInActiveWorkspaceTerminalAction, FocusActiveTerminalAction, FocusNextTerminalAction, FocusPreviousTerminalAction, SelectDefaultShellWindowsTerminalAction, RunSelectedTextInTerminalAction, RunActiveFileInTerminalAction, ScrollDownTerminalAction, ScrollDownPageTerminalAction, ScrollToBottomTerminalAction, ScrollUpTerminalAction, ScrollUpPageTerminalAction, ScrollToTopTerminalAction, TerminalPasteAction, ToggleTerminalAction, ClearTerminalAction, AllowWorkspaceShellTerminalCommand, DisallowWorkspaceShellTerminalCommand, RenameTerminalAction, SelectAllTerminalAction, FocusTerminalFindWidgetAction, HideTerminalFindWidgetAction, ShowNextFindTermTerminalFindWidgetAction, ShowPreviousFindTermTerminalFindWidgetAction, DeleteWordLeftTerminalAction, DeleteWordRightTerminalAction, QuickOpenActionTermContributor, QuickOpenTermAction, TERMINAL_PICKER_PREFIX, MoveToLineStartTerminalAction, MoveToLineEndTerminalAction, SplitTerminalAction, SplitInActiveWorkspaceTerminalAction, FocusPreviousPaneTerminalAction, FocusNextPaneTerminalAction, ResizePaneLeftTerminalAction, ResizePaneRightTerminalAction, ResizePaneUpTerminalAction, ResizePaneDownTerminalAction, ScrollToPreviousCommandAction, ScrollToNextCommandAction, SelectToPreviousCommandAction, SelectToNextCommandAction, SelectToPreviousLineAction, SelectToNextLineAction } from 'vs/workbench/parts/terminal/electron-browser/terminalActions'; +import { KillTerminalAction, ClearSelectionTerminalAction, CopyTerminalSelectionAction, CreateNewTerminalAction, CreateNewInActiveWorkspaceTerminalAction, FocusActiveTerminalAction, FocusNextTerminalAction, FocusPreviousTerminalAction, SelectDefaultShellWindowsTerminalAction, RunSelectedTextInTerminalAction, RunActiveFileInTerminalAction, ScrollDownTerminalAction, ScrollDownPageTerminalAction, ScrollToBottomTerminalAction, ScrollUpTerminalAction, ScrollUpPageTerminalAction, ScrollToTopTerminalAction, TerminalPasteAction, ToggleTerminalAction, ClearTerminalAction, AllowWorkspaceShellTerminalCommand, DisallowWorkspaceShellTerminalCommand, RenameTerminalAction, SelectAllTerminalAction, FocusTerminalFindWidgetAction, HideTerminalFindWidgetAction, DeleteWordLeftTerminalAction, DeleteWordRightTerminalAction, QuickOpenActionTermContributor, QuickOpenTermAction, TERMINAL_PICKER_PREFIX, MoveToLineStartTerminalAction, MoveToLineEndTerminalAction, SplitTerminalAction, SplitInActiveWorkspaceTerminalAction, FocusPreviousPaneTerminalAction, FocusNextPaneTerminalAction, ResizePaneLeftTerminalAction, ResizePaneRightTerminalAction, ResizePaneUpTerminalAction, ResizePaneDownTerminalAction, ScrollToPreviousCommandAction, ScrollToNextCommandAction, SelectToPreviousCommandAction, SelectToNextCommandAction, SelectToPreviousLineAction, SelectToNextLineAction } from 'vs/workbench/parts/terminal/electron-browser/terminalActions'; import { Registry } from 'vs/platform/registry/common/platform'; import { ShowAllCommandsAction } from 'vs/workbench/parts/quickopen/browser/commandsHandler'; import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; @@ -281,8 +281,6 @@ configurationRegistry.registerConfiguration({ SelectAllTerminalAction.ID, FocusTerminalFindWidgetAction.ID, HideTerminalFindWidgetAction.ID, - ShowPreviousFindTermTerminalFindWidgetAction.ID, - ShowNextFindTermTerminalFindWidgetAction.ID, NavigateUpAction.ID, NavigateDownAction.ID, NavigateRightAction.ID, @@ -439,8 +437,6 @@ actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(HideTerminalFind primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] }, ContextKeyExpr.and(KEYBINDING_CONTEXT_TERMINAL_FOCUS, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE)), 'Terminal: Hide Find Widget', category); -actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowNextFindTermTerminalFindWidgetAction, ShowNextFindTermTerminalFindWidgetAction.ID, ShowNextFindTermTerminalFindWidgetAction.LABEL, null, ContextKeyExpr.and(KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_INPUT_FOCUSED, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE)), 'Terminal: Show Next Find Term', category); -actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowPreviousFindTermTerminalFindWidgetAction, ShowPreviousFindTermTerminalFindWidgetAction.ID, ShowPreviousFindTermTerminalFindWidgetAction.LABEL, null, ContextKeyExpr.and(KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_INPUT_FOCUSED, KEYBINDING_CONTEXT_TERMINAL_FIND_WIDGET_VISIBLE)), 'Terminal: Show Previous Find Term', category); actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(DeleteWordLeftTerminalAction, DeleteWordLeftTerminalAction.ID, DeleteWordLeftTerminalAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.Backspace, mac: { primary: KeyMod.Alt | KeyCode.Backspace } diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts index 66c7c67b786..6a4b5997df5 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalActions.ts @@ -950,41 +950,6 @@ export class HideTerminalFindWidgetAction extends Action { } } -export class ShowNextFindTermTerminalFindWidgetAction extends Action { - - public static readonly ID = 'workbench.action.terminal.findWidget.history.showNext'; - public static readonly LABEL = nls.localize('nextTerminalFindTerm', "Show Next Find Term"); - - constructor( - id: string, label: string, - @ITerminalService private terminalService: ITerminalService - ) { - super(id, label); - } - - public run(): TPromise { - return TPromise.as(this.terminalService.showNextFindTermFindWidget()); - } -} - -export class ShowPreviousFindTermTerminalFindWidgetAction extends Action { - - public static readonly ID = 'workbench.action.terminal.findWidget.history.showPrevious'; - public static readonly LABEL = nls.localize('previousTerminalFindTerm', "Show Previous Find Term"); - - constructor( - id: string, label: string, - @ITerminalService private terminalService: ITerminalService - ) { - super(id, label); - } - - public run(): TPromise { - return TPromise.as(this.terminalService.showPreviousFindTermFindWidget()); - } -} - - export class QuickOpenActionTermContributor extends ActionBarContributor { constructor( diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts index 09e090d2b5c..03e0d5aa138 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalPanel.ts @@ -206,14 +206,6 @@ export class TerminalPanel extends Panel { this._findWidget.hide(); } - public showNextFindTermFindWidget(): void { - this._findWidget.showNextFindTerm(); - } - - public showPreviousFindTermFindWidget(): void { - this._findWidget.showPreviousFindTerm(); - } - private _attachEventListeners(): void { this._register(dom.addDisposableListener(this._parentDomElement, 'mousedown', (event: MouseEvent) => { if (this._terminalService.terminalInstances.length === 0) { diff --git a/src/vs/workbench/parts/terminal/electron-browser/terminalService.ts b/src/vs/workbench/parts/terminal/electron-browser/terminalService.ts index 370cb709b9b..a83995ab5f5 100644 --- a/src/vs/workbench/parts/terminal/electron-browser/terminalService.ts +++ b/src/vs/workbench/parts/terminal/electron-browser/terminalService.ts @@ -124,20 +124,6 @@ export class TerminalService extends AbstractTerminalService implements ITermina } } - public showNextFindTermFindWidget(): void { - const panel = this._panelService.getActivePanel() as TerminalPanel; - if (panel && panel.getId() === TERMINAL_PANEL_ID) { - panel.showNextFindTermFindWidget(); - } - } - - public showPreviousFindTermFindWidget(): void { - const panel = this._panelService.getActivePanel() as TerminalPanel; - if (panel && panel.getId() === TERMINAL_PANEL_ID) { - panel.showPreviousFindTermFindWidget(); - } - } - private _suggestShellChange(wasNewTerminalAction?: boolean): void { // Only suggest on Windows since $SHELL works great for macOS/Linux if (!platform.isWindows) { diff --git a/src/vs/workbench/parts/webview/electron-browser/baseWebviewEditor.ts b/src/vs/workbench/parts/webview/electron-browser/baseWebviewEditor.ts index 8436046783d..aca88aff9df 100644 --- a/src/vs/workbench/parts/webview/electron-browser/baseWebviewEditor.ts +++ b/src/vs/workbench/parts/webview/electron-browser/baseWebviewEditor.ts @@ -56,18 +56,6 @@ export abstract class BaseWebviewEditor extends BaseEditor { } } - public showNextFindTerm() { - if (this._webview) { - this._webview.showNextFindTerm(); - } - } - - public showPreviousFindTerm() { - if (this._webview) { - this._webview.showPreviousFindTerm(); - } - } - public get isWebviewEditor() { return true; } diff --git a/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts b/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts index bb2e022fc19..3b34b5184ee 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webview.contribution.ts @@ -15,8 +15,8 @@ import { EditorDescriptor, Extensions as EditorExtensions, IEditorRegistry } fro import { Extensions as ActionExtensions, IWorkbenchActionRegistry } from 'vs/workbench/common/actions'; import { Extensions as EditorInputExtensions, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor'; import { WebviewEditorInputFactory } from 'vs/workbench/parts/webview/electron-browser/webviewEditorInputFactory'; -import { KEYBINDING_CONTEXT_WEBVIEWEDITOR_FIND_WIDGET_INPUT_FOCUSED, KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE } from './baseWebviewEditor'; -import { HideWebViewEditorFindCommand, OpenWebviewDeveloperToolsAction, ReloadWebviewAction, ShowWebViewEditorFindTermCommand, ShowWebViewEditorFindWidgetCommand } from './webviewCommands'; +import { KEYBINDING_CONTEXT_WEBVIEWEDITOR_FOCUS, KEYBINDING_CONTEXT_WEBVIEW_FIND_WIDGET_VISIBLE } from './baseWebviewEditor'; +import { HideWebViewEditorFindCommand, OpenWebviewDeveloperToolsAction, ReloadWebviewAction, ShowWebViewEditorFindWidgetCommand } from './webviewCommands'; import { WebviewEditor } from './webviewEditor'; import { WebviewEditorInput } from './webviewEditorInput'; import { IWebviewEditorService, WebviewEditorService } from './webviewEditorService'; @@ -47,20 +47,6 @@ const showNextFindWdigetCommand = new ShowWebViewEditorFindWidgetCommand({ }); KeybindingsRegistry.registerCommandAndKeybindingRule(showNextFindWdigetCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); - -const showNextFindTermCommand = new ShowWebViewEditorFindTermCommand({ - id: 'editor.action.webvieweditor.showNextFindTerm', - precondition: KEYBINDING_CONTEXT_WEBVIEWEDITOR_FIND_WIDGET_INPUT_FOCUSED, -}, true); -KeybindingsRegistry.registerCommandAndKeybindingRule(showNextFindTermCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); - -const showPreviousFindTermCommand = new ShowWebViewEditorFindTermCommand({ - id: 'editor.action.webvieweditor.showPreviousFindTerm', - precondition: KEYBINDING_CONTEXT_WEBVIEWEDITOR_FIND_WIDGET_INPUT_FOCUSED, -}, false); -KeybindingsRegistry.registerCommandAndKeybindingRule(showPreviousFindTermCommand.toCommandAndKeybindingRule(KeybindingsRegistry.WEIGHT.editorContrib())); - - const hideCommand = new HideWebViewEditorFindCommand({ id: HideWebViewEditorFindCommand.ID, precondition: ContextKeyExpr.and( diff --git a/src/vs/workbench/parts/webview/electron-browser/webviewCommands.ts b/src/vs/workbench/parts/webview/electron-browser/webviewCommands.ts index 8655aa91f32..c30d4fa8c85 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webviewCommands.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webviewCommands.ts @@ -5,7 +5,7 @@ import { Action } from 'vs/base/common/actions'; import { TPromise } from 'vs/base/common/winjs.base'; -import { Command, ICommandOptions } from 'vs/editor/browser/editorExtensions'; +import { Command } from 'vs/editor/browser/editorExtensions'; import * as nls from 'vs/nls'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; @@ -33,25 +33,6 @@ export class HideWebViewEditorFindCommand extends Command { } } -export class ShowWebViewEditorFindTermCommand extends Command { - public static readonly Id = 'editor.action.webvieweditor.showPreviousFindTerm'; - - constructor(opts: ICommandOptions, private _next: boolean) { - super(opts); - } - - public runCommand(accessor: ServicesAccessor, args: any): void { - const webViewEditor = getActiveWebviewEditor(accessor); - if (webViewEditor) { - if (this._next) { - webViewEditor.showNextFindTerm(); - } else { - webViewEditor.showPreviousFindTerm(); - } - } - } -} - export class OpenWebviewDeveloperToolsAction extends Action { static readonly ID = 'workbench.action.webview.openDeveloperTools'; static readonly LABEL = nls.localize('openToolsLabel', "Open Webview Developer Tools"); diff --git a/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts b/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts index 4cc5af9bf5b..690d7ed32b6 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webviewElement.ts @@ -427,14 +427,6 @@ export class WebviewElement { this._webviewFindWidget.hide(); } - public showNextFindTerm() { - this._webviewFindWidget.showNextFindTerm(); - } - - public showPreviousFindTerm() { - this._webviewFindWidget.showPreviousFindTerm(); - } - public reload() { this.contents = this._contents; } diff --git a/src/vs/workbench/parts/webview/electron-browser/webviewFindWidget.ts b/src/vs/workbench/parts/webview/electron-browser/webviewFindWidget.ts index 53ac36126e8..11b28c59136 100644 --- a/src/vs/workbench/parts/webview/electron-browser/webviewFindWidget.ts +++ b/src/vs/workbench/parts/webview/electron-browser/webviewFindWidget.ts @@ -7,21 +7,15 @@ import { SimpleFindWidget } from 'vs/editor/contrib/find/simpleFindWidget'; import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; import { WebviewElement } from './webviewElement'; import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey'; -import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding'; -import { INotificationService } from 'vs/platform/notification/common/notification'; -import { IStorageService } from 'vs/platform/storage/common/storage'; export class WebviewFindWidget extends SimpleFindWidget { constructor( private readonly webview: WebviewElement, @IContextViewService contextViewService: IContextViewService, - @IContextKeyService contextKeyService: IContextKeyService, - @IKeybindingService keybindingService: IKeybindingService, - @INotificationService notificationService: INotificationService, - @IStorageService storageService: IStorageService + @IContextKeyService contextKeyService: IContextKeyService ) { - super(contextViewService, contextKeyService, keybindingService, notificationService, storageService); + super(contextViewService, contextKeyService); } public find(previous: boolean) { -- GitLab