Skip to content

Commit b410e9c

Browse files
authored
revert chat code block pasting (microsoft#234297)
* revert commit * compile/hygiene
1 parent d12854f commit b410e9c

File tree

10 files changed

+15
-331
lines changed

10 files changed

+15
-331
lines changed

src/vs/editor/common/languages.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,14 +1758,7 @@ export interface IWorkspaceTextEdit {
17581758
}
17591759

17601760
export interface WorkspaceEdit {
1761-
edits: Array<IWorkspaceTextEdit | IWorkspaceFileEdit | ICustomEdit>;
1762-
}
1763-
1764-
export interface ICustomEdit {
1765-
readonly resource: URI;
1766-
readonly metadata?: WorkspaceEditMetadata;
1767-
undo(): Promise<void> | void;
1768-
redo(): Promise<void> | void;
1761+
edits: Array<IWorkspaceTextEdit | IWorkspaceFileEdit>;
17691762
}
17701763

17711764
export interface Rejection {

src/vs/monaco.d.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7962,14 +7962,7 @@ declare namespace monaco.languages {
79627962
}
79637963

79647964
export interface WorkspaceEdit {
7965-
edits: Array<IWorkspaceTextEdit | IWorkspaceFileEdit | ICustomEdit>;
7966-
}
7967-
7968-
export interface ICustomEdit {
7969-
readonly resource: Uri;
7970-
readonly metadata?: WorkspaceEditMetadata;
7971-
undo(): Promise<void> | void;
7972-
redo(): Promise<void> | void;
7965+
edits: Array<IWorkspaceTextEdit | IWorkspaceFileEdit>;
79737966
}
79747967

79757968
export interface Rejection {

src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import { BulkTextEdits } from './bulkTextEdits.js';
2828
import { IEditorService } from '../../../services/editor/common/editorService.js';
2929
import { ILifecycleService, ShutdownReason } from '../../../services/lifecycle/common/lifecycle.js';
3030
import { IWorkingCopyService } from '../../../services/workingCopy/common/workingCopyService.js';
31-
import { OpaqueEdits, ResourceAttachmentEdit } from './opaqueEdits.js';
3231

3332
function liftEdits(edits: ResourceEdit[]): ResourceEdit[] {
3433
return edits.map(edit => {
@@ -41,11 +40,6 @@ function liftEdits(edits: ResourceEdit[]): ResourceEdit[] {
4140
if (ResourceNotebookCellEdit.is(edit)) {
4241
return ResourceNotebookCellEdit.lift(edit);
4342
}
44-
45-
if (ResourceAttachmentEdit.is(edit)) {
46-
return ResourceAttachmentEdit.lift(edit);
47-
}
48-
4943
throw new Error('Unsupported edit');
5044
});
5145
}
@@ -128,8 +122,6 @@ class BulkEdit {
128122
resources.push(await this._performTextEdits(<ResourceTextEdit[]>group, this._undoRedoGroup, this._undoRedoSource, progress));
129123
} else if (group[0] instanceof ResourceNotebookCellEdit) {
130124
resources.push(await this._performCellEdits(<ResourceNotebookCellEdit[]>group, this._undoRedoGroup, this._undoRedoSource, progress));
131-
} else if (group[0] instanceof ResourceAttachmentEdit) {
132-
resources.push(await this._performOpaqueEdits(<ResourceAttachmentEdit[]>group, this._undoRedoGroup, this._undoRedoSource, progress));
133125
} else {
134126
console.log('UNKNOWN EDIT');
135127
}
@@ -156,12 +148,6 @@ class BulkEdit {
156148
const model = this._instaService.createInstance(BulkCellEdits, undoRedoGroup, undoRedoSource, progress, this._token, edits);
157149
return await model.apply();
158150
}
159-
160-
private async _performOpaqueEdits(edits: ResourceAttachmentEdit[], undoRedoGroup: UndoRedoGroup, undoRedoSource: UndoRedoSource | undefined, progress: IProgress<void>): Promise<readonly URI[]> {
161-
this._logService.debug('_performOpaqueEdits', JSON.stringify(edits));
162-
const model = this._instaService.createInstance(OpaqueEdits, undoRedoGroup, undoRedoSource, progress, this._token, edits);
163-
return await model.apply();
164-
}
165151
}
166152

167153
export class BulkEditService implements IBulkEditService {

src/vs/workbench/contrib/bulkEdit/browser/opaqueEdits.ts

Lines changed: 0 additions & 79 deletions
This file was deleted.

src/vs/workbench/contrib/chat/browser/chat.contribution.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,6 @@ import { ILanguageModelIgnoredFilesService, LanguageModelIgnoredFilesService } f
7878
import { ChatGettingStartedContribution } from './actions/chatGettingStarted.js';
7979
import { Extensions, IConfigurationMigrationRegistry } from '../../../common/configuration.js';
8080
import { ChatEditorOverlayController } from './chatEditorOverlay.js';
81-
import { ITextModelContentProvider, ITextModelService } from '../../../../editor/common/services/resolverService.js';
82-
import { URI } from '../../../../base/common/uri.js';
83-
import { ILanguageService } from '../../../../editor/common/languages/language.js';
84-
import { ITextModel } from '../../../../editor/common/model.js';
85-
import { IModelService } from '../../../../editor/common/services/model.js';
86-
import { ChatInputPart } from './chatInputPart.js';
8781
import { ChatRelatedFilesContribution } from './contrib/chatInputRelatedFilesContrib.js';
8882

8983
// Register configuration
@@ -189,9 +183,6 @@ class ChatResolverContribution extends Disposable {
189183
constructor(
190184
@IEditorResolverService editorResolverService: IEditorResolverService,
191185
@IInstantiationService instantiationService: IInstantiationService,
192-
@ITextModelService private readonly textModelService: ITextModelService,
193-
@IModelService private readonly modelService: IModelService,
194-
@ILanguageService private readonly languageService: ILanguageService
195186
) {
196187
super();
197188

@@ -212,32 +203,12 @@ class ChatResolverContribution extends Disposable {
212203
}
213204
}
214205
));
215-
216-
this._register(new ChatInputBoxContentProvider(this.textModelService, this.modelService, this.languageService));
217206
}
218207
}
219208

220209
AccessibleViewRegistry.register(new ChatResponseAccessibleView());
221210
AccessibleViewRegistry.register(new PanelChatAccessibilityHelp());
222211
AccessibleViewRegistry.register(new QuickChatAccessibilityHelp());
223-
class ChatInputBoxContentProvider extends Disposable implements ITextModelContentProvider {
224-
constructor(
225-
textModelService: ITextModelService,
226-
private readonly modelService: IModelService,
227-
private readonly languageService: ILanguageService,
228-
) {
229-
super();
230-
this._register(textModelService.registerTextModelContentProvider(ChatInputPart.INPUT_SCHEME, this));
231-
}
232-
233-
async provideTextContent(resource: URI): Promise<ITextModel | null> {
234-
const existing = this.modelService.getModel(resource);
235-
if (existing) {
236-
return existing;
237-
}
238-
return this.modelService.createModel('', this.languageService.createById('chatinput'), resource);
239-
}
240-
}
241212

242213
class ChatSlashStaticSlashCommandsContribution extends Disposable {
243214

src/vs/workbench/contrib/chat/browser/chatContentParts/chatAttachmentsContentPart.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as dom from '../../../../../base/browser/dom.js';
7-
import { IManagedHoverTooltipMarkdownString } from '../../../../../base/browser/ui/hover/hover.js';
87
import { createInstantHoverDelegate } from '../../../../../base/browser/ui/hover/hoverDelegateFactory.js';
98
import { Emitter } from '../../../../../base/common/event.js';
109
import { Disposable, DisposableStore } from '../../../../../base/common/lifecycle.js';
@@ -20,8 +19,8 @@ import { IInstantiationService } from '../../../../../platform/instantiation/com
2019
import { IOpenerService, OpenInternalOptions } from '../../../../../platform/opener/common/opener.js';
2120
import { FolderThemeIcon, IThemeService } from '../../../../../platform/theme/common/themeService.js';
2221
import { ResourceLabels } from '../../../../browser/labels.js';
23-
import { IChatRequestVariableEntry, isPasteVariableEntry } from '../../common/chatModel.js';
2422
import { revealInSideBarCommand } from '../../../files/browser/fileActions.contribution.js';
23+
import { IChatRequestVariableEntry } from '../../common/chatModel.js';
2524
import { ChatResponseReferencePartStatusKind, IChatContentReference } from '../../common/chatService.js';
2625

2726
export class ChatAttachmentsContentPart extends Disposable {
@@ -127,25 +126,6 @@ export class ChatAttachmentsContentPart extends Disposable {
127126
if (!this.attachedContextDisposables.isDisposed) {
128127
this.attachedContextDisposables.add(this.hoverService.setupManagedHover(hoverDelegate, widget, hoverElement));
129128
}
130-
} else if (isPasteVariableEntry(attachment)) {
131-
ariaLabel = localize('chat.attachment', "Attached context, {0}", attachment.name);
132-
133-
const hoverContent: IManagedHoverTooltipMarkdownString = {
134-
markdown: {
135-
value: `\`\`\`${attachment.language}\n${attachment.code}\n\`\`\``,
136-
},
137-
markdownNotSupportedFallback: attachment.code,
138-
};
139-
140-
const classNames = ['file-icon', `${attachment.language}-lang-file-icon`];
141-
label.setLabel(attachment.fileName, undefined, { extraClasses: classNames });
142-
widget.appendChild(dom.$('span.attachment-additional-info', {}, `Pasted ${attachment.pastedLines}`));
143-
144-
widget.style.position = 'relative';
145-
146-
if (!this.attachedContextDisposables.isDisposed) {
147-
this.attachedContextDisposables.add(this.hoverService.setupManagedHover(hoverDelegate, widget, hoverContent, { trapFocus: true }));
148-
}
149129
} else {
150130
const attachmentLabel = attachment.fullName ?? attachment.name;
151131
const withIcon = attachment.icon?.id ? `$(${attachment.icon.id}) ${attachmentLabel}` : attachmentLabel;

src/vs/workbench/contrib/chat/browser/chatInputPart.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { StandardKeyboardEvent } from '../../../../base/browser/keyboardEvent.js
1111
import { StandardMouseEvent } from '../../../../base/browser/mouseEvent.js';
1212
import * as aria from '../../../../base/browser/ui/aria/aria.js';
1313
import { Button } from '../../../../base/browser/ui/button/button.js';
14-
import { IManagedHoverTooltipMarkdownString } from '../../../../base/browser/ui/hover/hover.js';
1514
import { IHoverDelegate } from '../../../../base/browser/ui/hover/hoverDelegate.js';
1615
import { createInstantHoverDelegate } from '../../../../base/browser/ui/hover/hoverDelegateFactory.js';
1716
import { renderLabelWithIcons } from '../../../../base/browser/ui/iconLabel/iconLabels.js';
@@ -76,7 +75,7 @@ import { revealInSideBarCommand } from '../../files/browser/fileActions.contribu
7675
import { ChatAgentLocation, IChatAgentService } from '../common/chatAgents.js';
7776
import { ChatContextKeys } from '../common/chatContextKeys.js';
7877
import { ChatEditingSessionState, IChatEditingService, IChatEditingSession, WorkingSetEntryState } from '../common/chatEditingService.js';
79-
import { IChatRequestVariableEntry, isPasteVariableEntry } from '../common/chatModel.js';
78+
import { IChatRequestVariableEntry } from '../common/chatModel.js';
8079
import { ChatRequestDynamicVariablePart } from '../common/chatParserTypes.js';
8180
import { IChatFollowup } from '../common/chatService.js';
8281
import { IChatResponseViewModel } from '../common/chatViewModel.js';
@@ -843,23 +842,6 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
843842
store.add(this.hoverService.setupManagedHover(hoverDelegate, widget, hoverElement, { trapFocus: false }));
844843
resolve();
845844
}));
846-
} else if (isPasteVariableEntry(attachment)) {
847-
ariaLabel = localize('chat.attachment', "Attached context, {0}", attachment.name);
848-
849-
const hoverContent: IManagedHoverTooltipMarkdownString = {
850-
markdown: {
851-
value: `\`\`\`${attachment.language}\n${attachment.code}\n\`\`\``,
852-
},
853-
markdownNotSupportedFallback: attachment.code,
854-
};
855-
856-
const classNames = ['file-icon', `${attachment.language}-lang-file-icon`];
857-
label.setLabel(attachment.fileName, undefined, { extraClasses: classNames });
858-
widget.appendChild(dom.$('span.attachment-additional-info', {}, `Pasted ${attachment.pastedLines}`));
859-
860-
widget.style.position = 'relative';
861-
store.add(this.hoverService.setupManagedHover(hoverDelegate, widget, hoverContent, { trapFocus: true }));
862-
this.attachButtonAndDisposables(widget, index, attachment, hoverDelegate);
863845
} else {
864846
const attachmentLabel = attachment.fullName ?? attachment.name;
865847
const withIcon = attachment.icon?.id ? `$(${attachment.icon.id}) ${attachmentLabel}` : attachmentLabel;

0 commit comments

Comments
 (0)