/// import { DeltaDecorationParams, Dimension, EditorMouseEvent, EncodingMode, Position, Range, ReplaceTextParams, RevealPositionOptions, RevealRangeOptions, TextDocumentChangeEvent, TextEditor } from '@tartjs/editor/lib/browser/editor'; import { ElementExt } from '@lumino/domutils'; import { Disposable, DisposableCollection, Emitter, Event, TextDocumentContentChangeDelta } from '@tartjs/core/lib/common'; import URI from '@tartjs/core/lib/common/uri'; import { MonacoEditorModel } from './monaco-editor-model'; import { MonacoToProtocolConverter } from './monaco-to-protocol-converter'; import { ProtocolToMonacoConverter } from './protocol-to-monaco-converter'; import { ContextKeyService } from '@tartjs/core/lib/browser/context-key-service'; import { TextEdit } from 'vscode-languageserver-types'; import IStandaloneEditorConstructionOptions = monaco.editor.IStandaloneEditorConstructionOptions; import IModelDeltaDecoration = monaco.editor.IModelDeltaDecoration; import IEditorOverrideServices = monaco.editor.IEditorOverrideServices; import IStandaloneCodeEditor = monaco.editor.IStandaloneCodeEditor; import IBoxSizing = ElementExt.IBoxSizing; import { EditorDecoration } from '@tartjs/editor/lib/browser/decorations/editor-decoration'; import { EditorManager } from '@tartjs/editor/lib/browser/editor-manager'; import { EditorWidget } from '@tartjs/editor/lib/browser/editor-widget'; export declare class MonacoEditorServices { protected readonly m2p: MonacoToProtocolConverter; protected readonly p2m: ProtocolToMonacoConverter; protected readonly contextKeyService: ContextKeyService; constructor(services: MonacoEditorServices); } export declare class MonacoEditor extends MonacoEditorServices implements TextEditor { readonly uri: URI; readonly document: MonacoEditorModel; readonly node: HTMLElement; onEncodingChanged: Event; readonly documents: Set; 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; protected readonly onScrollChangedEmitter: Emitter; protected readonly onResizeEmitter: Emitter; readonly onDidResize: Event; constructor(uri: URI, document: MonacoEditorModel, node: HTMLElement, services: MonacoEditorServices, options?: MonacoEditor.IOptions, override?: IEditorOverrideServices); get onDispose(): Event; get onDocumentContentChanged(): Event; get cursor(): Position; set cursor(cursor: Position); get onCursorPositionChanged(): Event; get selection(): Range; set selection(selection: Range); get onSelectionChanged(): Event; get onScrollChanged(): Event; get onFocusChanged(): Event; get onMouseDown(): Event; get commandService(): monaco.commands.ICommandService; get instantiationService(): monaco.instantiation.IInstantiationService; protected _languageAutoDetected: boolean; get languageAutoDetected(): boolean; getEncoding(): string; setEncoding(encoding: string, mode: EncodingMode): Promise; getVisibleRanges(): Range[]; revealPosition(raw: Position, options?: RevealPositionOptions): void; revealRange(raw: Range, options?: RevealRangeOptions): void; focus(): void; blur(): void; isFocused({ strict }?: { strict: boolean; }): boolean; /** * `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; trigger(source: string, handlerId: string, payload: any): void; getControl(): IStandaloneCodeEditor; refresh(): void; resizeToFit(): void; setSize(dimension: Dimension): void; isActionSupported(id: string): boolean; runAction(id: string): Promise; deltaDecorations(params: DeltaDecorationParams): string[]; getLinesDecorations(startLineNumber: number, endLineNumber: number): (EditorDecoration & Readonly<{ id: string; }>)[]; getVisibleColumn(position: Position): number; replaceText(params: ReplaceTextParams): Promise; executeEdits(edits: TextEdit[]): boolean; storeViewState(): object; restoreViewState(state: monaco.editor.ICodeEditorViewState): void; detectLanguage(): Promise; setLanguage(languageId: string): void; getResourceUri(): URI; createMoveToUri(resourceUri: URI): URI; protected create(options?: IStandaloneEditorConstructionOptions, override?: monaco.editor.IEditorOverrideServices): Disposable; protected addHandlers(codeEditor: IStandaloneCodeEditor): void; protected mapModelContentChange(change: monaco.editor.IModelContentChange): TextDocumentContentChangeDelta; 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; protected toDeltaDecorations(params: DeltaDecorationParams): IModelDeltaDecoration[]; protected toEditorDecoration(decoration: monaco.editor.IModelDecoration): EditorDecoration & Readonly<{ id: string; }>; protected fireLanguageChanged(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, 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 | undefined): EditorWidget | undefined; }