import { Event } from "../../../../base/common/event.js"; import { IMarkdownString } from "../../../../base/common/htmlContent.js"; import { IDisposable, IReference } from "../../../../base/common/lifecycle.js"; import { URI } from "../../../../base/common/uri.js"; import { RawContextKey } from "../../../../platform/contextkey/common/contextkey.js"; import { IRevertOptions, ISaveOptions } from "../../../common/editor.js"; import { EditorInput } from "../../../common/editor/editorInput.js"; import { RegisteredEditorPriorityInfo } from "../../../services/editor/common/editorResolverService.js"; export declare const CONTEXT_ACTIVE_CUSTOM_EDITOR_ID: RawContextKey; export declare const CONTEXT_FOCUSED_CUSTOM_EDITOR_IS_EDITABLE: RawContextKey; /** * A built-in editor input that replaced a custom editor contributed by an extension. Extensions * keep seeing it as that custom editor, for example in the tab API and the `activeCustomEditorId` * context key. */ export interface ICustomEditorCompatibleInput { /** * View type of the custom editor that the input replaced. */ readonly customEditorViewType: string; readonly resource: URI; } export declare function isCustomEditorCompatibleInput(input: EditorInput | undefined): input is EditorInput & ICustomEditorCompatibleInput; export interface CustomEditorCapabilities { readonly supportsMultipleEditorsPerDocument?: boolean; readonly isTextEditor?: boolean; readonly supportsInlineDiff?: boolean; readonly supportsSideBySideDiff?: boolean; } export interface ICustomEditorModelManager { getAllModels(resource: URI): Promise; get(resource: URI, viewType: string): Promise; tryRetain(resource: URI, viewType: string): Promise> | undefined; add(resource: URI, viewType: string, model: Promise): Promise>; disposeAllModelsForView(viewType: string): void; disposeAllModelsForResource(resource: URI): void; } export interface ICustomEditorModel extends IDisposable { readonly viewType: string; readonly resource: URI; readonly backupId: string | undefined; readonly canHotExit: boolean; isReadonly(): boolean | IMarkdownString; readonly onDidChangeReadonly: Event; isOrphaned(): boolean; readonly onDidChangeOrphaned: Event; isDirty(): boolean; readonly onDidChangeDirty: Event; revert(options?: IRevertOptions): Promise; saveCustomEditor(options?: ISaveOptions): Promise; saveCustomEditorAs(resource: URI, targetResource: URI, currentOptions?: ISaveOptions): Promise; } export declare enum CustomEditorPriority { default = "default", builtin = "builtin", option = "option", explicit = "explicit" } export declare enum CustomEditorDiffEditorLayout { Inline = "inline", SideBySide = "sideBySide" } export interface CustomEditorSelector { readonly filenamePattern?: string; } export type CustomEditorPriorityInfo = Omit; export interface CustomEditorDescriptor { readonly id: string; readonly displayName: string; readonly providerDisplayName: string; readonly priority: CustomEditorPriorityInfo; readonly selector: readonly CustomEditorSelector[]; } export declare class CustomEditorInfo implements CustomEditorDescriptor { readonly id: string; readonly displayName: string; readonly providerDisplayName: string; readonly priority: CustomEditorPriorityInfo; readonly selector: readonly CustomEditorSelector[]; constructor(descriptor: CustomEditorDescriptor); matches(resource: URI): boolean; } export declare class CustomEditorInfoCollection { readonly allEditors: readonly CustomEditorInfo[]; constructor(editors: readonly CustomEditorInfo[]); get length(): number; /** * Find the single default editor to use (if any) by looking at the editor's priority and the * other contributed editors. */ get defaultEditor(): CustomEditorInfo | undefined; /** * Find the best available editor to use. * * Unlike the `defaultEditor`, a bestAvailableEditor can exist even if there are other editors with * the same priority. */ get bestAvailableEditor(): CustomEditorInfo | undefined; }