import { StandardMouseEvent } from "../../../../../../base/browser/mouseEvent.js"; import { Event } from "../../../../../../base/common/event.js"; import { Disposable } from "../../../../../../base/common/lifecycle.js"; import { ThemeIcon } from "../../../../../../base/common/themables.js"; import { URI } from "../../../../../../base/common/uri.js"; import { ILanguageService } from "../../../../../../editor/common/languages/language.service.js"; import { IModelService } from "../../../../../../editor/common/services/model.service.js"; import { ITextModelService } from "../../../../../../editor/common/services/resolverService.service.js"; import { IHoverService } from "../../../../../../platform/hover/browser/hover.service.js"; import { ILabelService } from "../../../../../../platform/label/common/label.service.js"; import { IOpenEditorOptions } from "../../../../../../platform/editor/browser/editor.js"; /** * The shared DOM + styling for a "code block pill" — the small chip rendered in * chat output that announces a file edit (e.g. "file.ts Edited +5 -2"). * * This class is intentionally agnostic of where the diff information comes * from. Subclasses or callers feed in URI, status icon/label, +/- counts, and * an optional progress percentage. Two consumers exist today: * * - {@link CollapsedCodeBlock} (chat editing pipeline) wires the pill to an * {@link IChatEditingSession} so the status and diff update as edits stream * in. * - {@link ChatExternalEditContentPart} (agent host pipeline) renders a static * pill from data already provided by the agent host. */ export declare class ChatEditPillElement extends Disposable { protected readonly labelService: ILabelService; protected readonly modelService: IModelService; protected readonly languageService: ILanguageService; protected readonly hoverService: IHoverService; readonly element: HTMLElement; protected readonly pillElement: HTMLElement; protected readonly statusIndicatorContainer: HTMLElement; protected readonly statusIconEl: HTMLElement; protected readonly statusLabelEl: HTMLElement; protected readonly progressFillEl: HTMLElement; protected readonly fileIconEl: HTMLElement; protected readonly fileIconLabelEl: HTMLElement; protected readonly labelDetailEl: HTMLElement; private readonly _hover; private _tooltip; private _uri; get uri(): URI | undefined; private _statusIconClasses; private _pillIconClasses; private _labelAddedEl; private _labelRemovedEl; private readonly _onDidClick; /** Fires when the pill is activated (click / keyboard). Carries the standard open-editor options. */ readonly onDidClick: Event; private readonly _onDidContextMenu; /** Fires on right-click. Subclasses can present a context menu. */ readonly onDidContextMenu: Event; constructor(labelService: ILabelService, modelService: IModelService, languageService: ILanguageService, hoverService: IHoverService); /** * Renders or updates the file icon + name. Call this whenever the URI * changes; also resets the +added / -removed counters since they no * longer apply to the previous file. */ setUri(uri: URI): void; /** * Updates the leading status indicator (icon + textual label). Pass * `undefined` to clear the icon. */ setStatus(icon: ThemeIcon | undefined, label: string): void; /** * Sets the trailing detail label (e.g. "Generating edits...", "(35%)"). * Pass an empty string to clear. */ setLabelDetail(text: string): void; /** * Renders the progress-fill animation behind the pill. `percent` is in * the range [0, 100]. Pass `undefined` (or omit) to clear. */ setProgressFill(percent: number | undefined): void; /** * Renders the +added / -removed counters at the trailing end of the pill * and sets the aria label to a localized summary. Pass `undefined` to * hide the counters. */ setDiff(diff: { added: number; removed: number; } | undefined): void; /** * Sets the screen-reader announcement for the pill. */ setAriaLabel(label: string): void; /** * Sets the delayed hover tooltip text. Re-using the existing hover binding * so subsequent calls just swap the displayed text. */ setTooltip(tooltip: string): void; } /** * Resolves the given resource and reports whether it has no content, which is * the case when a file was newly created or was empty before an edit. * * The pill consumers use this to decide whether opening a diff editor is * meaningful: a pure addition into an empty (or non-existent) original has * nothing to diff against, so the resulting file should open in a normal * editor instead. */ export declare function isResourceContentEmpty(textModelService: ITextModelService, uri: URI): Promise;