import * as glob from "../../../../base/common/glob.js"; import { IDisposable } from "../../../../base/common/lifecycle.js"; import { URI, Event } from "../../../../sessions/sessions.web.main.internal.js"; import { IUntypedEditorInput } from "../../../common/editor.js"; import { EditorAssociations, IEditorResolverServiceGetEditorMatchesOptions, EditorMatches, RegisteredEditorRegistrationInfo, RegisteredEditorOptions, EditorInputFactoryObject, ResolvedEditor, IEditorResolverServiceGetEditorsOptions, RegisteredEditorInfo, IEditorResolverServiceGetAllEditorsOptions } from "./editorResolverService.js"; import { PreferredGroup } from "./editorService.js"; export declare const IEditorResolverService: import("../../../../platform/instantiation/common/instantiation.js").ServiceIdentifier; export interface IEditorResolverService { readonly _serviceBrand: undefined; /** * Given a resource finds the editor associations that match it from the user's settings * @param resource The resource to match * @return The matching associations */ getAssociationsForResource(resource: URI): EditorAssociations; /** * Returns an immutable snapshot of the editors matching a resource and the rule selecting its default. */ getEditorMatches(resource: URI, options?: IEditorResolverServiceGetEditorMatchesOptions): EditorMatches; /** * Sets an editor as the default for a resource, removing a redundant association when restoring * the natural default supplied by editor registrations or the Text Editor fallback. * @param resource The resource whose editor default is changing. * @param editorID The ID of the editor to make the default. * @param forDiffEditor When `true`, the diff editor association (`workbench.diffEditorAssociations`) * is updated instead of the general editor association (`workbench.editorAssociations`). */ setDefaultEditor(resource: URI, editorID: string, forDiffEditor?: boolean): void; /** * Removes the user's diff editor association (`workbench.diffEditorAssociations`) for the given * glob pattern if it applies to the resource, so that the general editor association also applies to diffs. * @param resource The resource whose diff editor default is being removed. * @param filenamePattern The glob pattern of the diff editor association to remove. */ removeDiffEditorAssociation(resource: URI, filenamePattern: string): void; /** * Emitted when an editor is registered or unregistered. */ readonly onDidChangeEditorRegistrations: Event; /** * Given a callback, run the callback pausing the registration emitter */ bufferChangeEvents(callback: Function): void; /** * Registers a specific editor. Editors with the same glob pattern and ID will be grouped together by the resolver. * This allows for registration of the factories in different locations * @param globPattern The glob pattern for this registration * @param editorInfo Information about the registration * @param options Specific options which apply to this registration * @param editorFactoryObject The editor input factory functions */ registerEditor(globPattern: string | glob.IRelativePattern, editorInfo: RegisteredEditorRegistrationInfo, options: RegisteredEditorOptions, editorFactoryObject: EditorInputFactoryObject): IDisposable; /** * Given an editor resolves it to the suitable ResolvedEditor based on user extensions, settings, and built-in editors * @param editor The editor to resolve * @param preferredGroup The group you want to open the editor in * @returns An EditorInputWithOptionsAndGroup if there is an available editor or a status of how to proceed */ resolveEditor(editor: IUntypedEditorInput, preferredGroup: PreferredGroup | undefined): Promise; /** * Given a resource returns all the editor ids that match that resource. If there is exclusive editor we return an empty array * @param resource The resource * @returns A list of editor ids */ getEditors(resource: URI, options?: IEditorResolverServiceGetEditorsOptions): RegisteredEditorInfo[]; /** * A set of all the editors that are registered to the editor resolver. */ getEditors(options?: IEditorResolverServiceGetAllEditorsOptions): RegisteredEditorInfo[]; /** * Returns the id of the best editor that can render a *diff* for the resource, excluding the * built-in default text editor. This intentionally includes editors that opted out of diffs via a * `explicit` priority: such editors opt out for text files, but when the default text diff editor * cannot render the content (e.g. it is binary) a custom diff editor is preferable to the generic * "cannot display" fallback. Returns `undefined` when no such (diff-capable) editor exists. * @param resource The resource being diffed */ getBinaryDiffFallbackEditor(resource: URI): string | undefined; /** * Get a complete list of editor associations. */ getAllUserAssociations(): EditorAssociations; }