/******************************************************************************** * Copyright (C) 2017 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 { TextDocumentSaveReason, Position, TextDocumentContentChangeEvent } from 'vscode-languageserver-types'; import { MonacoToProtocolConverter, ProtocolToMonacoConverter } from 'monaco-languageclient'; import { TextEditorDocument } from '@devpodio/editor/lib/browser'; import { DisposableCollection, Emitter, Event, Resource, CancellationTokenSource, CancellationToken } from '@devpodio/core'; import ITextEditorModel = monaco.editor.ITextEditorModel; import { Range } from 'vscode-languageserver-types'; export { TextDocumentSaveReason }; export interface WillSaveMonacoModelEvent { readonly model: MonacoEditorModel; readonly reason: TextDocumentSaveReason; waitUntil(thenable: Thenable): void; } export interface MonacoModelContentChangedEvent { readonly model: MonacoEditorModel; readonly contentChanges: TextDocumentContentChangeEvent[]; } export declare class MonacoEditorModel implements ITextEditorModel, TextEditorDocument { protected readonly resource: Resource; protected readonly m2p: MonacoToProtocolConverter; protected readonly p2m: ProtocolToMonacoConverter; autoSave: 'on' | 'off'; autoSaveDelay: number; readonly onWillSaveLoopTimeOut = 1500; protected model: monaco.editor.IModel; protected readonly resolveModel: Promise; protected readonly toDispose: DisposableCollection; protected readonly toDisposeOnAutoSave: DisposableCollection; protected readonly onDidChangeContentEmitter: Emitter; readonly onDidChangeContent: Event; protected readonly onDidSaveModelEmitter: Emitter; readonly onDidSaveModel: Event; protected readonly onWillSaveModelEmitter: Emitter; readonly onWillSaveModel: Event; constructor(resource: Resource, m2p: MonacoToProtocolConverter, p2m: ProtocolToMonacoConverter); dispose(): void; /** * #### Important * Only this method can create an instance of `monaco.editor.IModel`, * there should not be other calls to `monaco.editor.createModel`. */ protected initialize(content: string): void; protected _dirty: boolean; readonly dirty: boolean; protected setDirty(dirty: boolean): void; protected readonly onDirtyChangedEmitter: Emitter; readonly onDirtyChanged: Event; readonly uri: string; protected _languageId: string | undefined; readonly languageId: string; /** * It's a hack to dispatch close notification with an old language id, don't use it. */ setLanguageId(languageId: string | undefined): void; readonly version: number; /** * Return selected text by Range or all text by default */ getText(range?: Range): string; positionAt(offset: number): Position; offsetAt(position: Position): number; readonly lineCount: number; /** * Retrieves a line in a text document expressed as a one-based position. */ getLineContent(lineNumber: number): string; getLineMaxColumn(lineNumber: number): number; readonly readOnly: boolean; readonly onDispose: monaco.IEvent; readonly textEditorModel: monaco.editor.IModel; load(): monaco.Promise; save(): Promise; protected pendingOperation: Promise; run(operation: () => Promise): Promise; protected syncCancellationTokenSource: CancellationTokenSource; protected cancelSync(): CancellationToken; sync(): Promise; protected doSync(token: CancellationToken): Promise; protected readContents(): Promise; protected ignoreDirtyEdits: boolean; protected markAsDirty(): void; protected doAutoSave(): void; protected saveCancellationTokenSource: CancellationTokenSource; protected cancelSave(): CancellationToken; protected scheduleSave(reason: TextDocumentSaveReason, token?: CancellationToken): Promise; protected ignoreContentChanges: boolean; protected contentChanges: TextDocumentContentChangeEvent[]; protected pushContentChanges(contentChanges: TextDocumentContentChangeEvent[]): void; protected popContentChanges(): TextDocumentContentChangeEvent[]; protected fireDidChangeContent(event: monaco.editor.IModelContentChangedEvent): void; protected asContentChangedEvent(event: monaco.editor.IModelContentChangedEvent): MonacoModelContentChangedEvent; protected asTextDocumentContentChangeEvent(change: monaco.editor.IModelContentChange): TextDocumentContentChangeEvent; protected applyEdits(operations: monaco.editor.IIdentifiedSingleEditOperation[], options?: Partial): monaco.editor.IIdentifiedSingleEditOperation[]; protected doSave(reason: TextDocumentSaveReason, token: CancellationToken): Promise; protected fireWillSaveModel(reason: TextDocumentSaveReason, token: CancellationToken): Promise; protected fireDidSaveModel(): void; } export declare namespace MonacoEditorModel { interface ApplyEditsOptions { ignoreDirty: boolean; ignoreContentChanges: boolean; } } //# sourceMappingURL=monaco-editor-model.d.ts.map