import * as glob from "../../../../base/common/glob.js"; import { URI } from "../../../../base/common/uri.js"; import { IResourceEditorInput, ITextResourceEditorInput } from "../../../../platform/editor/common/editor.js"; import { EditorInputWithOptions, EditorInputWithOptionsAndGroup, IResourceDiffEditorInput, IResourceMultiDiffEditorInput, IResourceMergeEditorInput, IUntitledTextResourceEditorInput } from "../../../common/editor.js"; import { IEditorGroup } from "./editorGroupsService.js"; import { AtLeastOne } from "../../../../base/common/types.js"; export type EditorAssociation = { readonly viewType: string; readonly filenamePattern?: string; }; export type EditorAssociations = readonly EditorAssociation[]; export declare const editorsAssociationsSettingId = "workbench.editorAssociations"; export declare const diffEditorsAssociationsSettingId = "workbench.diffEditorAssociations"; export declare const hiddenEditorTypesSettingId = "workbench.editor.hiddenEditorTypes"; /** * Setting that controls whether the Markdown editor is the default editor for * `*.md` files in the Agents window. Gated behind an experiment so it can be * rolled out gradually. Defaults to on. */ export declare const markdownDefaultEditorAgentsWindowSettingId = "workbench.editor.markdownDefaultEditorInAgentsWindow"; /** * Builds the default value for `workbench.editorAssociations` in the Agents window. * Shared so that dynamic re-registrations of the setting preserve the override. * * Pass `false` to use the Markdown preview editor for `*.md` files. */ export declare function editorsAssociationsAgentsWindowDefault(options?: { markdownDefaultEditor?: boolean; integratedBrowserAvailable?: boolean; }): Record; export declare function diffEditorsAssociationsAgentsWindowDefault(options?: { markdownDefaultEditor?: boolean; }): Record; export interface IEditorType { readonly id: string; readonly displayName: string; readonly providerDisplayName: string; } export declare enum RegisteredEditorPriority { builtin = "builtin", option = "option", exclusive = "exclusive", default = "default", /** * The editor is not automatically used for this kind of input or opted into by an association * from another input kind. It requires an association for this input kind or an explicit open. */ explicit = "explicit" } /** * If we didn't resolve an editor dictates what to do with the opening state * ABORT = Do not continue with opening the editor * NONE = Continue as if the resolution has been disabled as the service could not resolve one */ export declare enum ResolvedStatus { ABORT = 1, NONE = 2 } export type ResolvedEditor = EditorInputWithOptionsAndGroup | ResolvedStatus; export type RegisteredEditorOptions = { /** * If your editor cannot be opened in multiple groups for the same resource */ singlePerResource?: boolean | (() => boolean); /** * Whether or not you can support opening the given resource. * If omitted we assume you can open everything */ canSupportResource?: (resource: URI) => boolean; }; export interface IEditorResolverServiceGetEditorsOptions { /** * Excludes optional editors registered for `*`, unless they are configured or currently active. */ readonly excludeUnconfiguredUniversalOptionalEditors?: boolean; readonly currentEditorId?: string; readonly isDiffEditor?: boolean; } export interface IEditorResolverServiceGetEditorMatchesOptions { readonly isDiffEditor?: boolean; } export interface IEditorResolverServiceGetAllEditorsOptions { /** * Excludes registrations whose editor priority is exclusive. */ readonly excludeExclusiveEditors?: boolean; /** * Excludes registrations that cannot create a diff editor. */ readonly isDiffEditor?: boolean; } export declare enum EditorMatchRuleSource { UserAssociation = 0, EditorRegistration = 1, Fallback = 2 } /** * The effective rule that makes one editor choice available for a resource. */ export type EditorMatchRule = { readonly editor: RegisteredEditorInfo; readonly priority: RegisteredEditorPriority; readonly associationPattern: string; } & ({ readonly source: EditorMatchRuleSource.UserAssociation; readonly association: EditorAssociation; } | { readonly source: EditorMatchRuleSource.EditorRegistration; readonly globPattern: string | glob.IRelativePattern; } | { readonly source: EditorMatchRuleSource.Fallback; }); export declare function isUnconfiguredUniversalOptionalEditorMatch(rule: EditorMatchRule): boolean; /** * An immutable snapshot containing one effective rule per matching editor and the rule selecting its default. */ export declare class EditorMatches { readonly matches: readonly EditorMatchRule[]; readonly defaultRuleIndex: number; readonly defaultRule: EditorMatchRule; readonly naturalDefaultRuleIndex: number; readonly naturalDefaultRule: EditorMatchRule; readonly conflictingDefault: boolean; readonly hasExclusiveMatch: boolean; constructor(matches: readonly EditorMatchRule[], defaultRuleIndex: number, naturalDefaultRuleIndex: number, conflictingDefault: boolean); } export type RegisteredEditorPriorityInfo = { readonly editor: RegisteredEditorPriority; readonly diff: RegisteredEditorPriority; readonly merge: RegisteredEditorPriority; }; export type RegisteredEditorPriorityConfiguration = Omit & { readonly merge?: RegisteredEditorPriority; }; export type RegisteredEditorInfo = { readonly id: string; readonly label: string; readonly detail?: string; readonly priority: RegisteredEditorPriorityInfo; }; export type RegisteredEditorRegistrationInfo = Omit & { readonly priority: RegisteredEditorPriority | RegisteredEditorPriorityConfiguration; }; export declare function toRegisteredEditorPriorityInfo(priority: RegisteredEditorPriority | RegisteredEditorPriorityConfiguration): RegisteredEditorPriorityInfo; type EditorInputFactoryResult = EditorInputWithOptions | Promise; export type EditorInputFactoryFunction = (editorInput: IResourceEditorInput | ITextResourceEditorInput, group: IEditorGroup) => EditorInputFactoryResult; export type UntitledEditorInputFactoryFunction = (untitledEditorInput: IUntitledTextResourceEditorInput, group: IEditorGroup) => EditorInputFactoryResult; export type DiffEditorInputFactoryFunction = (diffEditorInput: IResourceDiffEditorInput, group: IEditorGroup) => EditorInputFactoryResult; export type MultiDiffEditorInputFactoryFunction = (multiDiffEditorInput: IResourceMultiDiffEditorInput, group: IEditorGroup) => EditorInputFactoryResult; export type MergeEditorInputFactoryFunction = (mergeEditorInput: IResourceMergeEditorInput, group: IEditorGroup) => EditorInputFactoryResult; type EditorInputFactories = { createEditorInput?: EditorInputFactoryFunction; createUntitledEditorInput?: UntitledEditorInputFactoryFunction; createDiffEditorInput?: DiffEditorInputFactoryFunction; createMultiDiffEditorInput?: MultiDiffEditorInputFactoryFunction; createMergeEditorInput?: MergeEditorInputFactoryFunction; }; export type EditorInputFactoryObject = AtLeastOne; export declare function priorityToRank(priority: RegisteredEditorPriority): number; export declare function globMatchesResource(globPattern: string | glob.IRelativePattern, resource: URI): boolean; export {};