Skip to content

Fix custom diff editor restore and custom names#314582

Merged
mjbvz merged 1 commit intomicrosoft:mainfrom
mjbvz:dev/mjbvz/conscious-baboon
May 6, 2026
Merged

Fix custom diff editor restore and custom names#314582
mjbvz merged 1 commit intomicrosoft:mainfrom
mjbvz:dev/mjbvz/conscious-baboon

Conversation

@mjbvz
Copy link
Copy Markdown
Collaborator

@mjbvz mjbvz commented May 5, 2026

Make sure that custom diff editors show custom names such as the (Indexed) title that get provides

Also makes sure custom diff editors are restored on reload by creating serializers for them

Make sure that custom diff editors show custom names such as the `(Indexed)` title that get provides

Also makes sure custom diff editors are restored on reload by creating serializers for them
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the custom editor workbench integration so custom editor tabs can pick up caller-provided labels and so custom diff editors can participate in editor restoration after reload. It touches the custom editor resolver path, the editor input types, and the serializer/registration plumbing that lets the workbench reopen these editors.

Changes:

  • Seed CustomEditorInput with a preferred display name from resolver-provided labels.
  • Add serializers and editor-pane registrations for inline and side-by-side custom diff editor inputs.
  • Thread the new preferredName field through custom editor input creation and simplify readonly capability computation.
Show a summary per file
File Description
src/vs/workbench/contrib/customEditor/browser/customEditors.ts Passes resolver labels into custom editor inputs and updates diff/custom-editor construction paths.
src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.ts Adds restore serializers for custom diff inputs and updates existing custom editor restore/create paths.
src/vs/workbench/contrib/customEditor/browser/customEditorInput.ts Extends custom editor input init data with preferredName and uses isReadonly() in capability calculation.
src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.ts Registers the new diff input types with the webview editor pane and serializer registry.

Copilot's findings

Comments suppressed due to low confidence (1)

src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.ts:212

  • The side-by-side diff serializer has the same hot-exit gap: it restores the tab shape but never carries the modified document's backupId back into model creation. After a window reload, dirty custom diffs reopen against the saved file contents instead of the backup, so unsaved changes are lost.
	deserialize(_instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput {
		const data: SerializedCustomEditorSideBySideDiff = JSON.parse(serializedEditorInput);
		return CustomEditorSideBySideDiffInput.create(this._instantiationService, {
			originalResource: URI.revive(data.originalResource),
			modifiedResource: URI.revive(data.modifiedResource),
			viewType: data.viewType,
			label: data.label,
			description: data.description,
			iconPath: undefined,
			diffId: data.diffId,
			side: data.side,
		}, undefined);
  • Files reviewed: 4/4 changed files
  • Comments generated: 1

Comment on lines +153 to +162
deserialize(_instantiationService: IInstantiationService, serializedEditorInput: string): EditorInput {
const data: SerializedCustomEditorDiff = JSON.parse(serializedEditorInput);
return CustomEditorDiffInput.create(this._instantiationService, {
originalResource: URI.revive(data.originalResource),
modifiedResource: URI.revive(data.modifiedResource),
viewType: data.viewType,
label: data.label,
description: data.description,
iconPath: undefined,
}, undefined);
@mjbvz mjbvz merged commit 18d2953 into microsoft:main May 6, 2026
44 of 45 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.120.0 milestone May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants