Code change:
when i want to compare a local file with a online resource file, i need to save the online file in project folder, and then do compare. it's a little inconvenient. It'll be great if i can copy the content of the online file, and right-click the local file, and choose "compare with clipboard".
An extension would be ideal for a feature like this.
fyi
It would be great too if also is allowed to compare selection with clipboard.
It would be great if we could compare unsaved files...
I would be open to a PR here, I think it is not a lot of work. Some pointers: register a new text document content provider to be able to open the left hand side of the diff editor to be the contents of the clipboard (pointers: ) register a new action to diff the current editor with the resource that can be handled with from the text document content provider (similar to ) Due to sensitivity of data inside the clipboard it would probably make sense to ask the user for confirmation that the clipboard is accessed. Related to
Has someone taken up this issue? I am a complete beginner to the VSCode codebase, would I be able to contribute to this issue?
not yet, but it seems has started a similar PR in which could be used as input to this one. The difference is that the contents of the left hand side are coming from the clipboard instead of the file on disk.

Related discussion:
text: } } <ins> export class CompareWithClipboardAction extends Action { public static ID = 'workbench.files.action.compareWithClipboard'; public static LABEL = nls.localize('compareWithClipboard', "Compare Active File with Clipboard"); private static SCHEME = 'clipboard'; private toDispose: IDisposable[]; constructor( id: string, label: string, @IWorkbenchEditorService private editorService: IWorkbenchEditorService, @IInstantiationService private instantiationService: IInstantiationService, @ITextModelService private textModelService: ITextModelService, ) { super(id, label); this.enabled = true; this.toDispose = []; } public run(): TPromise<any> { let resource: URI = toResource(this.editorService.getActiveEditorInput(), { supportSideBySide: true, filter: 'file' } ); const provider = this.instantiationService.createInstance(ClipboardContentProvider); const registrationDisposal = this.textModelService.registerTextModelContentProvider(CompareWithClipboardAction.SCHEME, provider); this.toDispose.push(registrationDisposal); if (resource) { const name = paths.basename(resource.fsPath); const editorLabel = nls.localize('clipboardComparisonLabel', "Clipboard ↔ {0}", name); return this.editorService.openEditor({ leftResource: URI.from({ scheme: CompareWithClipboardAction.SCHEME, path: resource.fsPath }), rightResource: resource, label: editorLabel }); } return TPromise.as(true); } public dispose(): void { super.dispose(); this.toDispose = dispose(this.toDispose); } } class ClipboardContentProvider implements ITextModelContentProvider { constructor( @IClipboardService private clipboardService: IClipboardService, @IModeService private modeService: IModeService, @IModelService private modelService: IModelService ) { } provideTextContent(resource: URI): TPromise<IModel> { const model = this.modelService.createModel(this.clipboardService.readText(), this.modeService.getOrCreateMode('text/plain'), resource); return TPromise.as(model); } } </ins> // Diagnostics support let diag: (...args: any[]) => void; if (!diag) {