import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri"; import { IInstantiationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation"; import { UntitledTextEditorModel, IUntitledTextEditorModel } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/untitled/common/untitledTextEditorModel"; import { IConfigurationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service"; import { Event } from "@codingame/monaco-vscode-api/vscode/vs/base/common/event"; import { Disposable } from "@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle"; import { IUntitledTextEditorService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/untitled/common/untitledTextEditorService.service"; export interface INewUntitledTextEditorOptions { /** * Initial value of the untitled editor. An untitled editor with initial * value is dirty right from the beginning. */ initialValue?: string; /** * Preferred language id to use when saving the untitled editor. */ languageId?: string; /** * Preferred encoding to use when saving the untitled editor. */ encoding?: string; } export interface IExistingUntitledTextEditorOptions extends INewUntitledTextEditorOptions { /** * A resource to identify the untitled editor to create or return * if already existing. * * Note: the resource will not be used unless the scheme is `untitled`. */ untitledResource?: URI; } export interface INewUntitledTextEditorWithAssociatedResourceOptions extends INewUntitledTextEditorOptions { /** * Resource components to associate with the untitled editor. When saving * the untitled editor, the associated components will be used and the user * is not being asked to provide a file path. * * Note: currently it is not possible to specify the `scheme` to use. The * untitled editor will saved to the default local or remote resource. */ associatedResource?: { authority: string; path: string; query: string; fragment: string; }; } type IInternalUntitledTextEditorOptions = IExistingUntitledTextEditorOptions & INewUntitledTextEditorWithAssociatedResourceOptions; export interface IUntitledTextEditorModelSaveEvent { /** * The source untitled file that was saved. It is disposed at this point. */ readonly source: URI; /** * The target file the untitled was saved to. Is never untitled. */ readonly target: URI; } export interface IUntitledTextEditorModelManager extends IUntitledTextEditorService { /** * Internal method: triggers the onDidSave event. */ notifyDidSave(source: URI, target: URI): void; } export declare class UntitledTextEditorService extends Disposable implements IUntitledTextEditorModelManager { private readonly instantiationService; private readonly configurationService; readonly _serviceBrand: undefined; private static readonly UNTITLED_WITHOUT_ASSOCIATED_RESOURCE_REGEX; private readonly _onDidSave; readonly onDidSave: Event; private readonly _onDidChangeDirty; readonly onDidChangeDirty: Event; private readonly _onDidChangeEncoding; readonly onDidChangeEncoding: Event; private readonly _onDidCreate; readonly onDidCreate: Event; private readonly _onWillDispose; readonly onWillDispose: Event; private readonly _onDidChangeLabel; readonly onDidChangeLabel: Event; private readonly mapResourceToModel; constructor(instantiationService: IInstantiationService, configurationService: IConfigurationService); get(resource: URI): UntitledTextEditorModel | undefined; getValue(resource: URI): string | undefined; resolve(options?: IInternalUntitledTextEditorOptions): Promise; create(options?: IInternalUntitledTextEditorOptions): UntitledTextEditorModel; private doCreateOrGet; private massageOptions; private doCreate; private registerModel; isUntitledWithAssociatedResource(resource: URI): boolean; canDispose(model: UntitledTextEditorModel): true | Promise; private doCanDispose; notifyDidSave(source: URI, target: URI): void; } export {};