import { ElementExt } from '@theia/core/shared/@lumino/domutils';
import URI from '@theia/core/lib/common/uri';
import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
import { DisposableCollection, Disposable, Emitter, Event } from '@theia/core/lib/common';
import { Dimension, EditorManager, EditorWidget, Position, Range, TextDocumentContentChangeDelta, TextDocumentChangeEvent, TextEditor, RevealRangeOptions, RevealPositionOptions, DeltaDecorationParams, ReplaceTextParams, EditorDecoration, EditorMouseEvent, EncodingMode } from '@theia/editor/lib/browser';
import { MonacoEditorModel } from './monaco-editor-model';
import { MonacoToProtocolConverter } from './monaco-to-protocol-converter';
import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter';
import { TextEdit } from '@theia/core/shared/vscode-languageserver-protocol';
import * as monaco from '@theia/monaco-editor-core';
import { IInstantiationService, ServiceIdentifier } from '@theia/monaco-editor-core/esm/vs/platform/instantiation/common/instantiation';
import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
import { IStandaloneEditorConstructionOptions } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneCodeEditor';
import { MarkdownString } from '@theia/core/lib/common/markdown-rendering';
import { Selection } from '@theia/editor/lib/browser/editor';
import { MonacoTextModelService } from './monaco-text-model-service';
export type ServicePair<T> = [ServiceIdentifier<T>, T];
export interface EditorServiceOverrides extends Iterable<ServicePair<unknown>> {
}
export declare class MonacoEditorServices {
    protected readonly m2p: MonacoToProtocolConverter;
    protected readonly p2m: ProtocolToMonacoConverter;
    protected readonly contextKeyService: ContextKeyService;
    protected readonly monacoModelService: MonacoTextModelService;
    constructor(services: MonacoEditorServices);
}
export declare class MonacoEditor extends MonacoEditorServices implements TextEditor {
    readonly uri: URI;
    readonly document: MonacoEditorModel;
    readonly node: HTMLElement;
    readonly parentEditor?: MonacoEditor | undefined;
    static create(uri: URI, document: MonacoEditorModel, node: HTMLElement, services: MonacoEditorServices, options?: MonacoEditor.IOptions, override?: EditorServiceOverrides, parentEditor?: MonacoEditor): Promise<MonacoEditor>;
    protected readonly toDispose: DisposableCollection;
    protected readonly autoSizing: boolean;
    protected readonly minHeight: number;
    protected readonly maxHeight: number;
    protected editor: monaco.editor.IStandaloneCodeEditor;
    protected readonly onCursorPositionChangedEmitter: Emitter<Position>;
    protected readonly onSelectionChangedEmitter: Emitter<Selection>;
    protected readonly onFocusChangedEmitter: Emitter<boolean>;
    protected readonly onDocumentContentChangedEmitter: Emitter<TextDocumentChangeEvent>;
    protected readonly onMouseDownEmitter: Emitter<EditorMouseEvent>;
    readonly onDidChangeReadOnly: Event<boolean | MarkdownString>;
    protected readonly onLanguageChangedEmitter: Emitter<string>;
    readonly onLanguageChanged: Event<string>;
    protected readonly onScrollChangedEmitter: Emitter<void>;
    readonly onEncodingChanged: Event<string>;
    protected readonly onResizeEmitter: Emitter<Dimension | null>;
    readonly onDidResize: Event<Dimension | null>;
    protected readonly onShouldDisplayDirtyDiffChangedEmitter: Emitter<boolean>;
    readonly onShouldDisplayDirtyDiffChanged: Event<boolean> | undefined;
    readonly documents: Set<MonacoEditorModel>;
    protected savedViewState: monaco.editor.IEditorViewState | null;
    protected constructor(uri: URI, document: MonacoEditorModel, node: HTMLElement, services: MonacoEditorServices, options?: MonacoEditor.IOptions, override?: EditorServiceOverrides, parentEditor?: MonacoEditor | undefined);
    protected init(): Promise<void>;
    getEncoding(): string;
    setEncoding(encoding: string, mode: EncodingMode): Promise<void>;
    protected create(options?: monaco.editor.IStandaloneEditorConstructionOptions | IStandaloneEditorConstructionOptions, override?: EditorServiceOverrides): Disposable;
    protected getInstantiatorWithOverrides(override?: EditorServiceOverrides): IInstantiationService;
    protected addHandlers(codeEditor: monaco.editor.IStandaloneCodeEditor): void;
    handleVisibilityChanged(nowVisible: boolean): void;
    /**
     * Temporarily restores the editor model and forces a synchronous render
     * so that the canvas content is available for visual preview capture.
     * Must be followed by {@link unstagePreview} to clean up.
     */
    stageForPreview(): void;
    /**
     * Reverts the model restoration performed by {@link stageForPreview}.
     */
    unstagePreview(): void;
    private _stagedForPreview;
    /**
     * This property allows working with the underlying editor instance
     * through the base editor interface, `monaco.editor.IEditor`.
     *
     * This property is intended to be overriden in subclasses as needed,
     * e.g. it returns the underlying diff editor in `MonacoDiffEditor`.
     */
    protected get baseEditor(): monaco.editor.IEditor;
    /**
     * This property allows working with the underlying editor model instance
     * through the base editor model interface, `monaco.editor.IEditorModel`.
     *
     * This property is intended to be overriden in subclasses as needed,
     * e.g. it returns the underlying diff editor model in `MonacoDiffEditor`.
     */
    protected get baseModel(): monaco.editor.IEditorModel;
    getVisibleRanges(): Range[];
    protected mapModelContentChange(change: monaco.editor.IModelContentChange): TextDocumentContentChangeDelta;
    get onDispose(): Event<void>;
    get onDocumentContentChanged(): Event<TextDocumentChangeEvent>;
    get isReadonly(): boolean | MarkdownString;
    get cursor(): Position;
    set cursor(cursor: Position);
    get onCursorPositionChanged(): Event<Position>;
    get selection(): Selection;
    set selection(selection: Selection);
    get onSelectionChanged(): Event<Selection>;
    get onScrollChanged(): Event<void>;
    revealPosition(raw: Position, options?: RevealPositionOptions): void;
    revealRange(raw: Range, options?: RevealRangeOptions): void;
    focus(): void;
    isFocused({ strict }?: {
        strict: boolean;
    }): boolean;
    get onFocusChanged(): Event<boolean>;
    get onMouseDown(): Event<EditorMouseEvent>;
    /**
     * `true` if the suggest widget is visible in the editor. Otherwise, `false`.
     */
    isSuggestWidgetVisible(): boolean;
    /**
     * `true` if the find (and replace) widget is visible in the editor. Otherwise, `false`.
     */
    isFindWidgetVisible(): boolean;
    /**
     * `true` if the name rename refactoring input HTML element is visible. Otherwise, `false`.
     */
    isRenameInputVisible(): boolean;
    dispose(): void;
    isDisposed(): boolean;
    trigger(source: string, handlerId: string, payload: any): void;
    getControl(): monaco.editor.IStandaloneCodeEditor;
    refresh(): void;
    resizeToFit(): void;
    setSize(dimension: Dimension): void;
    protected autoresize(): void;
    protected resize(dimension: Dimension | null): void;
    protected computeLayoutSize(hostNode: HTMLElement, dimension: monaco.editor.IDimension | null): monaco.editor.IDimension;
    protected getWidth(hostNode: HTMLElement, boxSizing: ElementExt.IBoxSizing): number;
    protected getHeight(hostNode: HTMLElement, boxSizing: ElementExt.IBoxSizing): number;
    isActionSupported(id: string): boolean;
    runAction(id: string): Promise<void>;
    deltaDecorations(params: DeltaDecorationParams): string[];
    protected toDeltaDecorations(params: DeltaDecorationParams): monaco.editor.IModelDeltaDecoration[];
    protected fromStringToMarkdownString(hoverMessage?: string | monaco.IMarkdownString | monaco.IMarkdownString[]): monaco.IMarkdownString | monaco.IMarkdownString[] | undefined;
    protected fromMarkdownToString(maybeMarkdown?: null | string | monaco.IMarkdownString | monaco.IMarkdownString[]): string | undefined;
    getLinesDecorations(startLineNumber: number, endLineNumber: number): (EditorDecoration & Readonly<{
        id: string;
    }>)[];
    protected toEditorDecoration(decoration: monaco.editor.IModelDecoration): EditorDecoration & Readonly<{
        id: string;
    }>;
    getVisibleColumn(position: Position): number;
    replaceText(params: ReplaceTextParams): Promise<boolean>;
    executeEdits(edits: TextEdit[]): boolean;
    storeViewState(): object;
    restoreViewState(state: monaco.editor.IEditorViewState): void;
    protected _languageAutoDetected: boolean;
    get languageAutoDetected(): boolean;
    detectLanguage(): Promise<void>;
    setLanguage(languageId: string): void;
    protected fireLanguageChanged(languageId: string): void;
    getResourceUri(): URI;
    createMoveToUri(resourceUri: URI): URI;
    private _shouldDisplayDirtyDiff;
    shouldDisplayDirtyDiff(): boolean;
    setShouldDisplayDirtyDiff(value: boolean): void;
}
export declare namespace MonacoEditor {
    interface ICommonOptions {
        /**
         * Whether an editor should be auto resized on a content change.
         *
         * #### Fixme
         * remove when https://github.com/Microsoft/monaco-editor/issues/103 is resolved
         */
        autoSizing?: boolean;
        /**
         * A minimal height of an editor in lines.
         *
         * #### Fixme
         * remove when https://github.com/Microsoft/monaco-editor/issues/103 is resolved
         */
        minHeight?: number;
        /**
         * A maximal height of an editor in lines.
         *
         * #### Fixme
         * remove when https://github.com/Microsoft/monaco-editor/issues/103 is resolved
         */
        maxHeight?: number;
    }
    interface IOptions extends ICommonOptions, monaco.editor.IStandaloneEditorConstructionOptions {
    }
    function getAll(manager: EditorManager): MonacoEditor[];
    function getCurrent(manager: EditorManager): MonacoEditor | undefined;
    function getActive(manager: EditorManager): MonacoEditor | undefined;
    function get(editorWidget: EditorWidget | undefined): MonacoEditor | undefined;
    function findByDocument(manager: EditorManager, document: MonacoEditorModel): MonacoEditor[];
    function getWidgetFor(manager: EditorManager, control: monaco.editor.ICodeEditor | ICodeEditor | undefined | null): EditorWidget | undefined;
    function createReadOnlyOptions(readOnly?: boolean | MarkdownString): monaco.editor.IEditorOptions;
}
//# sourceMappingURL=monaco-editor.d.ts.map