import { Delayer } from "../../../../base/common/async.js"; import { Disposable } from "../../../../base/common/lifecycle.js"; import { ICodeEditor } from "../../../browser/editorBrowser.js"; import { EditorAction, MultiEditorAction, ServicesAccessor } from "../../../browser/editorExtensions.js"; import { IEditorContribution } from "../../../common/editorCommon.js"; import { FindReplaceState, INewFindReplaceState } from "./findState.js"; import { IFindController } from "./findWidget.js"; import { IClipboardService } from "../../../../platform/clipboard/common/clipboardService.service.js"; import { IContextKeyService } from "../../../../platform/contextkey/common/contextkey.service.js"; import { IContextViewService } from "../../../../platform/contextview/browser/contextView.service.js"; import { IKeybindingService } from "../../../../platform/keybinding/common/keybinding.service.js"; import { INotificationService } from "../../../../platform/notification/common/notification.service.js"; import { IStorageService } from "../../../../platform/storage/common/storage.service.js"; import { IHoverService } from "../../../../platform/hover/browser/hover.service.js"; import { IConfigurationService } from "../../../../platform/configuration/common/configuration.service.js"; import { IAccessibilityService } from "../../../../platform/accessibility/common/accessibility.service.js"; export declare function getSelectionSearchString(editor: ICodeEditor, seedSearchStringFromSelection?: "single" | "multiple", seedSearchStringFromNonEmptySelection?: boolean): string | null; export declare enum FindStartFocusAction { NoFocusChange = 0, FocusFindInput = 1, FocusReplaceInput = 2 } export interface IFindStartOptions { forceRevealReplace: boolean; seedSearchStringFromSelection: "none" | "single" | "multiple"; seedSearchStringFromNonEmptySelection: boolean; seedSearchStringFromGlobalClipboard: boolean; shouldFocus: FindStartFocusAction; shouldAnimate: boolean; updateSearchScope: boolean; loop: boolean; } export interface IFindStartArguments { searchString?: string; replaceString?: string; isRegex?: boolean; matchWholeWord?: boolean; isCaseSensitive?: boolean; preserveCase?: boolean; findInSelection?: boolean; } export declare class CommonFindController extends Disposable implements IEditorContribution { static readonly ID = "editor.contrib.findController"; protected _editor: ICodeEditor; private readonly _findWidgetVisible; protected _state: FindReplaceState; protected _updateHistoryDelayer: Delayer; private _model; protected readonly _storageService: IStorageService; private readonly _clipboardService; protected readonly _contextKeyService: IContextKeyService; protected readonly _notificationService: INotificationService; protected readonly _hoverService: IHoverService; get editor(): ICodeEditor; static get(editor: ICodeEditor): CommonFindController | null; constructor(editor: ICodeEditor, contextKeyService: IContextKeyService, storageService: IStorageService, clipboardService: IClipboardService, notificationService: INotificationService, hoverService: IHoverService); dispose(): void; private disposeModel; private _onStateChanged; private saveQueryState; private loadQueryState; isFindInputFocused(): boolean; /** * Returns whether the Replace input was the last focused input in the find widget. * Returns false by default; overridden in FindController. */ wasReplaceInputLastFocused(): boolean; /** * Focuses the last focused element in the find widget. * Implemented by FindController; base implementation does nothing. */ focusLastElement(): void; getState(): FindReplaceState; closeFindWidget(): void; toggleCaseSensitive(): void; toggleWholeWords(): void; toggleRegex(): void; togglePreserveCase(): void; toggleSearchScope(): void; setSearchString(searchString: string): void; highlightFindOptions(ignoreWhenVisible?: boolean): void; protected _start(opts: IFindStartOptions, newState?: INewFindReplaceState): Promise; start(opts: IFindStartOptions, newState?: INewFindReplaceState): Promise; moveToNextMatch(): boolean; moveToPrevMatch(): boolean; goToMatch(index: number): boolean; replace(): boolean; replaceAll(): boolean; selectAllMatches(): boolean; getGlobalBufferTerm(): Promise; setGlobalBufferTerm(text: string): void; } export declare class FindController extends CommonFindController implements IFindController { private readonly _contextViewService; private readonly _keybindingService; private readonly _configurationService; private readonly _accessibilityService; private _widget; private _findOptionsWidget; private _findWidgetSearchHistory; private _replaceWidgetHistory; constructor(editor: ICodeEditor, _contextViewService: IContextViewService, _contextKeyService: IContextKeyService, _keybindingService: IKeybindingService, notificationService: INotificationService, _storageService: IStorageService, clipboardService: IClipboardService, hoverService: IHoverService, _configurationService: IConfigurationService, _accessibilityService: IAccessibilityService); protected _start(opts: IFindStartOptions, newState?: INewFindReplaceState): Promise; highlightFindOptions(ignoreWhenVisible?: boolean): void; private _createFindWidget; /** * Returns whether the Replace input was the last focused input in the find widget. */ wasReplaceInputLastFocused(): boolean; /** * Focuses the last focused element in the find widget. * This is more precise than just focusing the Find or Replace input, * as it can restore focus to checkboxes, buttons, etc. */ focusLastElement(): void; saveViewState(): any; restoreViewState(state: any): void; } export declare const StartFindAction: MultiEditorAction; export declare class StartFindWithArgsAction extends EditorAction { constructor(); run(accessor: ServicesAccessor, editor: ICodeEditor, args?: IFindStartArguments): Promise; } export declare class StartFindWithSelectionAction extends EditorAction { constructor(); run(accessor: ServicesAccessor, editor: ICodeEditor): Promise; } export declare abstract class MatchFindAction extends EditorAction { run(accessor: ServicesAccessor, editor: ICodeEditor): Promise; protected abstract _run(controller: CommonFindController): boolean; } export declare const NextMatchFindAction: MultiEditorAction; export declare const PreviousMatchFindAction: MultiEditorAction; export declare class MoveToMatchFindAction extends EditorAction { private _highlightDecorations; constructor(); run(accessor: ServicesAccessor, editor: ICodeEditor): void | Promise; private clearDecorations; private addDecorations; } export declare abstract class SelectionMatchFindAction extends EditorAction { run(accessor: ServicesAccessor, editor: ICodeEditor): Promise; protected abstract _run(controller: CommonFindController): boolean; } export declare class NextSelectionMatchFindAction extends SelectionMatchFindAction { constructor(); protected _run(controller: CommonFindController): boolean; } export declare class PreviousSelectionMatchFindAction extends SelectionMatchFindAction { constructor(); protected _run(controller: CommonFindController): boolean; } export declare const StartFindReplaceAction: MultiEditorAction;