import { CancellationToken } from "../../../../../../base/common/cancellation.js"; import { Disposable } from "../../../../../../base/common/lifecycle.js"; import { URI } from "../../../../../../base/common/uri.js"; import { IDiffEditor } from "../../../../../../editor/browser/editorBrowser.js"; import { ICodeEditorService } from "../../../../../../editor/browser/services/codeEditorService.service.js"; import { CodeEditorWidget } from "../../../../../../editor/browser/widget/codeEditor/codeEditorWidget.js"; import { IEditorOptions } from "../../../../../../editor/common/config/editorOptions.js"; import { ITextModel } from "../../../../../../editor/common/model.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 { IAccessibilityService } from "../../../../../../platform/accessibility/common/accessibility.service.js"; import { ILogService } from "../../../../../../platform/log/common/log.service.js"; import { MenuId } from "../../../../../../platform/actions/common/actions.js"; import { IConfigurationService } from "../../../../../../platform/configuration/common/configuration.service.js"; import { IContextKeyService } from "../../../../../../platform/contextkey/common/contextkey.service.js"; import { IDialogService } from "../../../../../../platform/dialogs/common/dialogs.service.js"; import { IInstantiationService } from "../../../../../../platform/instantiation/common/instantiation.js"; import { ILabelService } from "../../../../../../platform/label/common/label.service.js"; import { IOpenerService } from "../../../../../../platform/opener/common/opener.service.js"; import { IMarkdownVulnerability } from "../../../common/widget/annotations.js"; import { IChatResponseModel, IChatTextEditGroup } from "../../../common/model/chatModel.js"; import { IChatRequestViewModel, IChatResponseViewModel } from "../../../common/model/chatViewModel.js"; import { ChatTreeItem } from "../../chat.js"; import { IChatRendererDelegate } from "@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/browser/widget/chatListRenderer"; import { ChatEditorOptions } from "../chatOptions.js"; export interface ICodeBlockData { readonly codeBlockIndex: number; readonly element: IChatRequestViewModel | IChatResponseViewModel; /** * Text content for the code block. The CodeBlockPart will manage * creating and updating its own text model from this text. */ readonly text: string; readonly languageId: string; readonly codemapperUri?: URI; readonly vulns?: readonly IMarkdownVulnerability[]; readonly parentContextKeyService?: IContextKeyService; readonly renderOptions?: ICodeBlockRenderOptions; readonly chatSessionResource: URI; } export interface ICodeBlockActionContext { readonly code: string; readonly codemapperUri?: URI; readonly languageId?: string; readonly codeBlockIndex: number; readonly element: unknown; readonly chatSessionResource: URI | undefined; } export interface ICodeBlockRenderOptions { hideToolbar?: boolean; verticalPadding?: number; reserveWidth?: number; editorOptions?: IEditorOptions; maxHeightInLines?: number; } export declare class CodeBlockPart extends Disposable { private readonly editorOptions; readonly menuId: MenuId; private readonly isSimpleWidget; protected readonly modelService: IModelService; private readonly languageService; private readonly configurationService; private readonly accessibilityService; private readonly logService; private readonly textModelService; /** * Compute a pool reuse key for a code block. When the same key is used * across render cycles the pool will try to return the same CodeBlockPart, * which lets the setText append-optimisation avoid a full model reset. */ static poolKey(elementId: string, codeBlockIndex: number): string; readonly editor: CodeEditorWidget; private toolbar; private _toolbarFactory; private _pendingToolbarAriaLabel; private _pendingToolbarContext; private readonly contextKeyService; readonly element: HTMLElement; private readonly vulnsButton; private readonly vulnsListElement; private readonly _textModel; private currentCodeBlockData; private currentScrollWidth; private lastLayoutWidth; private _isHovered; private _isDropdownVisible; private _toolbarElement; private isDisposed; private resourceContextKey; private get verticalPadding(); constructor(editorOptions: ChatEditorOptions, menuId: MenuId, delegate: IChatRendererDelegate, overflowWidgetsDomNode: HTMLElement | undefined, isSimpleWidget: boolean | undefined, instantiationService: IInstantiationService, contextKeyService: IContextKeyService, modelService: IModelService, languageService: ILanguageService, configurationService: IConfigurationService, accessibilityService: IAccessibilityService, logService: ILogService, textModelService: ITextModelService); dispose(): void; get uri(): URI | undefined; private createEditor; focus(): void; private updatePaddingForLayout; private _ensureToolbar; private _configureForScreenReader; private getEditorOptionsFromConfig; layout(width?: number | undefined): void; private getContentHeight; render(data: ICodeBlockData, width: number): void; reset(): void; onDidRemount(): void; private clearWidgets; private updateEditor; private getVulnerabilitiesLabel; private updateContexts; private setText; private setLanguage; } export declare class ChatCodeBlockContentProvider extends Disposable { private readonly _modelService; constructor(textModelService: ITextModelService, _modelService: IModelService); } export interface ICodeCompareBlockActionContext { readonly element: IChatResponseViewModel; readonly diffEditor: IDiffEditor; readonly edit: IChatTextEditGroup; toggleDiffViewMode(): void; } export interface ICodeCompareBlockDiffData { modified: ITextModel; original: ITextModel; originalSha1: string; } export interface ICodeCompareBlockData { readonly element: ChatTreeItem; readonly edit: IChatTextEditGroup; readonly diffData: Promise; readonly parentContextKeyService?: IContextKeyService; readonly horizontalPadding?: number; readonly isReadOnly?: boolean; } export declare class CodeCompareBlockPart extends Disposable { private readonly options; readonly menuId: MenuId; private readonly isSimpleWidget; protected readonly modelService: IModelService; private readonly configurationService; private readonly accessibilityService; private readonly labelService; private readonly openerService; private readonly contextKeyService; private readonly diffEditor; private readonly resourceLabel; private readonly toolbar; readonly element: HTMLElement; private readonly messageElement; private readonly editorHeader; private readonly _lastDiffEditorViewModel; private currentScrollWidth; private currentHorizontalPadding; private lastLayoutWidth; constructor(options: ChatEditorOptions, menuId: MenuId, delegate: IChatRendererDelegate, overflowWidgetsDomNode: HTMLElement | undefined, isSimpleWidget: boolean | undefined, instantiationService: IInstantiationService, contextKeyService: IContextKeyService, modelService: IModelService, configurationService: IConfigurationService, accessibilityService: IAccessibilityService, labelService: ILabelService, openerService: IOpenerService); get uri(): URI | undefined; private createDiffEditor; focus(): void; private updatePaddingForLayout; private _configureForScreenReader; private getEditorOptionsFromConfig; layout(width?: number | undefined): void; render(data: ICodeCompareBlockData, width: number, token: CancellationToken): Promise; reset(): void; private clearWidgets; private updateEditor; } export declare class DefaultChatTextEditor { private readonly modelService; private readonly editorService; private readonly dialogService; private readonly _sha1; constructor(modelService: ITextModelService, editorService: ICodeEditorService, dialogService: IDialogService); apply(response: IChatResponseModel | IChatResponseViewModel, item: IChatTextEditGroup, diffEditor: IDiffEditor | undefined): Promise; private _applyWithDiffEditor; private _apply; private _checkSha1; discard(response: IChatResponseModel | IChatResponseViewModel, item: IChatTextEditGroup): void; }