/********************************************************************************
* Copyright (C) 2018 TypeFox and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the Eclipse
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
* with the GNU Classpath Exception which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
///
import { MonacoToProtocolConverter, ProtocolToMonacoConverter, TextEdit } from 'monaco-languageclient';
import { ElementExt } from '@phosphor/domutils';
import URI from '@devpodio/core/lib/common/uri';
import { DisposableCollection, Disposable, Emitter, Event } from '@devpodio/core/lib/common';
import { Dimension, EditorManager, EditorWidget, Position, Range, TextDocumentContentChangeDelta, TextDocumentChangeEvent, TextEditor, RevealRangeOptions, RevealPositionOptions, DeltaDecorationParams, ReplaceTextParams, EditorDecoration, EditorMouseEvent } from '@devpodio/editor/lib/browser';
import { MonacoEditorModel } from './monaco-editor-model';
import IEditorConstructionOptions = monaco.editor.IEditorConstructionOptions;
import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration;
import IEditorOverrideServices = monaco.editor.IEditorOverrideServices;
import IStandaloneCodeEditor = monaco.editor.IStandaloneCodeEditor;
import IBoxSizing = ElementExt.IBoxSizing;
export declare class MonacoEditor implements TextEditor {
readonly uri: URI;
readonly document: MonacoEditorModel;
readonly node: HTMLElement;
protected readonly m2p: MonacoToProtocolConverter;
protected readonly p2m: ProtocolToMonacoConverter;
protected readonly toDispose: DisposableCollection;
protected readonly autoSizing: boolean;
protected readonly minHeight: number;
protected readonly maxHeight: number;
protected editor: IStandaloneCodeEditor;
protected readonly onCursorPositionChangedEmitter: Emitter;
protected readonly onSelectionChangedEmitter: Emitter;
protected readonly onFocusChangedEmitter: Emitter;
protected readonly onDocumentContentChangedEmitter: Emitter;
protected readonly onMouseDownEmitter: Emitter;
protected readonly onLanguageChangedEmitter: Emitter;
readonly onLanguageChanged: Event;
readonly documents: Set;
constructor(uri: URI, document: MonacoEditorModel, node: HTMLElement, m2p: MonacoToProtocolConverter, p2m: ProtocolToMonacoConverter, options?: MonacoEditor.IOptions, override?: IEditorOverrideServices);
protected create(options?: IEditorConstructionOptions, override?: monaco.editor.IEditorOverrideServices): Disposable;
protected addHandlers(codeEditor: IStandaloneCodeEditor): void;
protected mapModelContentChange(change: monaco.editor.IModelContentChange): TextDocumentContentChangeDelta;
readonly onDispose: Event;
readonly onDocumentContentChanged: Event;
cursor: Position;
readonly onCursorPositionChanged: Event;
selection: Range;
readonly onSelectionChanged: Event;
revealPosition(raw: Position, options?: RevealPositionOptions): void;
revealRange(raw: Range, options?: RevealRangeOptions): void;
focus(): void;
blur(): void;
isFocused({ strict }?: {
strict: boolean;
}): boolean;
readonly onFocusChanged: Event;
readonly onMouseDown: Event;
/**
* `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;
getControl(): 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: IBoxSizing): number;
protected getHeight(hostNode: HTMLElement, boxSizing: IBoxSizing): number;
isActionSupported(id: string): boolean;
runAction(id: string): monaco.Promise;
readonly commandService: monaco.commands.ICommandService;
readonly instantiationService: monaco.instantiation.IInstantiationService;
deltaDecorations(params: DeltaDecorationParams): string[];
protected toDeltaDecorations(params: DeltaDecorationParams): IModelDeltaDecoration[];
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;
executeEdits(edits: TextEdit[]): boolean;
storeViewState(): object;
restoreViewState(state: object): void;
detectLanguage(): Promise;
setLanguage(languageId: string): 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, IEditorConstructionOptions {
}
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 | undefined): EditorWidget | undefined;
}
//# sourceMappingURL=monaco-editor.d.ts.map