提交 48abe896 编写于 作者: R rebornix

#38625, create find widget lazily.

上级 4fed11f8
......@@ -60,7 +60,7 @@ export class CommonFindController extends Disposable implements editorCommon.IEd
private static ID = 'editor.contrib.findController';
private _editor: ICodeEditor;
protected _editor: ICodeEditor;
private _findWidgetVisible: IContextKey<boolean>;
protected _state: FindReplaceState;
private _currentHistoryNavigator: HistoryNavigator<string>;
......@@ -329,19 +329,20 @@ export class FindController extends CommonFindController implements IFindControl
constructor(
editor: ICodeEditor,
@IContextViewService contextViewService: IContextViewService,
@IContextKeyService contextKeyService: IContextKeyService,
@IKeybindingService keybindingService: IKeybindingService,
@IThemeService themeService: IThemeService,
@IContextViewService private _contextViewService: IContextViewService,
@IContextKeyService private _contextKeyService: IContextKeyService,
@IKeybindingService private _keybindingService: IKeybindingService,
@IThemeService private _themeService: IThemeService,
@IStorageService storageService: IStorageService
) {
super(editor, contextKeyService, storageService);
this._widget = this._register(new FindWidget(editor, this, this._state, contextViewService, keybindingService, contextKeyService, themeService));
this._findOptionsWidget = this._register(new FindOptionsWidget(editor, this._state, keybindingService, themeService));
super(editor, _contextKeyService, storageService);
}
protected _start(opts: IFindStartOptions): void {
if (!this._widget) {
this._createFindWidget();
}
super._start(opts);
if (opts.shouldFocus === FindStartFocusAction.FocusReplaceInput) {
......@@ -352,12 +353,20 @@ export class FindController extends CommonFindController implements IFindControl
}
public highlightFindOptions(): void {
if (!this._widget) {
this._createFindWidget();
}
if (this._state.isRevealed) {
this._widget.highlightFindOptions();
} else {
this._findOptionsWidget.highlightFindOptions();
}
}
private _createFindWidget() {
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));
}
}
export class StartFindAction extends EditorAction {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册