提交 9536c27e 编写于 作者: S Sandeep Somavarapu 提交者: GitHub

Merge pull request #26969 from nicksnyder/search

Make SearchWidget dependencies injectable
......@@ -42,13 +42,12 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IMessageService } from 'vs/platform/message/common/message';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IContextKeyService, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { KeyCode } from 'vs/base/common/keyCodes';
import { PatternInputWidget, ExcludePatternInputWidget } from 'vs/workbench/parts/search/browser/patternInputWidget';
import { SearchRenderer, SearchDataSource, SearchSorter, SearchAccessibilityProvider, SearchFilter } from 'vs/workbench/parts/search/browser/searchResultsView';
import { SearchWidget } from 'vs/workbench/parts/search/browser/searchWidget';
import { SearchWidget, ISearchWidgetOptions } from 'vs/workbench/parts/search/browser/searchWidget';
import { RefreshAction, CollapseAllAction, ClearSearchResultsAction, ConfigureGlobalExclusionsAction } from 'vs/workbench/parts/search/browser/searchActions';
import { IReplaceService } from 'vs/workbench/parts/search/common/replace';
import Severity from 'vs/base/common/severity';
......@@ -117,7 +116,6 @@ export class SearchViewlet extends Viewlet {
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@ISearchWorkbenchService private searchWorkbenchService: ISearchWorkbenchService,
@IContextKeyService private contextKeyService: IContextKeyService,
@IKeybindingService private keybindingService: IKeybindingService,
@IReplaceService private replaceService: IReplaceService,
@IUntitledEditorService private untitledEditorService: IUntitledEditorService,
@IPreferencesService private preferencesService: IPreferencesService,
......@@ -290,12 +288,12 @@ export class SearchViewlet extends Viewlet {
let isWholeWords = this.viewletSettings['query.wholeWords'] === true;
let isCaseSensitive = this.viewletSettings['query.caseSensitive'] === true;
this.searchWidget = new SearchWidget(builder, this.contextViewService, this.themeService, {
this.searchWidget = this.instantiationService.createInstance(SearchWidget, builder, <ISearchWidgetOptions>{
value: contentPattern,
isRegex: isRegex,
isCaseSensitive: isCaseSensitive,
isWholeWords: isWholeWords
}, this.contextKeyService, this.keybindingService, this.instantiationService);
});
if (this.storageService.getBoolean(SearchViewlet.SHOW_REPLACE_STORAGE_KEY, StorageScope.WORKSPACE, true)) {
this.searchWidget.toggleReplace(true);
......
......@@ -21,7 +21,6 @@ import { IContextViewService } from 'vs/platform/contextview/browser/contextView
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import Event, { Emitter } from 'vs/base/common/event';
import { Builder } from 'vs/base/browser/builder';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { isSearchViewletFocussed, appendKeyBindingLabel } from 'vs/workbench/parts/search/browser/searchActions';
import { CONTEXT_FIND_WIDGET_NOT_VISIBLE } from 'vs/editor/contrib/find/common/findController';
......@@ -111,8 +110,14 @@ export class SearchWidget extends Widget {
private _onReplaceAll = this._register(new Emitter<void>());
public onReplaceAll: Event<void> = this._onReplaceAll.event;
constructor(container: Builder, private contextViewService: IContextViewService, private themeService: IThemeService, options: ISearchWidgetOptions = Object.create(null),
private keyBindingService: IContextKeyService, private keyBindingService2: IKeybindingService, private instantiationService: IInstantiationService) {
constructor(
container: Builder,
options: ISearchWidgetOptions,
@IContextViewService private contextViewService: IContextViewService,
@IThemeService private themeService: IThemeService,
@IContextKeyService private keyBindingService: IContextKeyService,
@IKeybindingService private keyBindingService2: IKeybindingService,
) {
super();
this.searchHistory = new HistoryNavigator<string>();
this.replaceActive = Constants.ReplaceActiveKey.bindTo(this.keyBindingService);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册